Holochain Forum

Link_entries Unknown Entry type error

Hello,

I’m attempting to link_entries & am getting an Unknown Entry type runtime error.

Here is the code:

pub fn create_collective_ledger(collective: &Collective, collective_address: &Address) -> ZomeApiResult<Address> {
	let ledger_name = format!("Primary Ledger for {}", collective.name).to_string();
	let ledger = Ledger {
		name: ledger_name,
		..Default::default()
	};
	let ledger_address = commit_ledger(ledger)?;
	hdk::link_entries(
		&collective_address,
		&ledger_address,
		"collective_leger",
		"ledger_primary"
	)?;
	Ok(ledger_address)
}

Here is the log re: link_entries

DEBUG 2019-12-27 03:04:43 [holochain_metrics::logger] store_entry_content/puid-6-74 crates/metrics/src/logger.rs:22 METRIC cogov.__hdk_validate_app_entry.latency 32
DEBUG 2019-12-27 03:04:43 [holochain::test-instance] store_entry_content/puid-6-74 crates/core/src/workflows/hold_entry.rs:91 workflow/hold_entry: is valid! QmVsCkBpQYzhgf6iotLao8tY7ZF3xW55CM6PKWXirziWUE
DEBUG 2019-12-27 03:04:43 [holochain::test-instance] store_entry_content/puid-6-74 crates/core/src/workflows/hold_entry.rs:100 workflow/hold_entry: HOLDING: QmVsCkBpQYzhgf6iotLao8tY7ZF3xW55CM6PKWXirziWUE
DEBUG 2019-12-27 03:04:43 [holochain::test-instance] call_zome_function/puid-e-e crates/core/src/nucleus/actions/call_zome_function.rs:110 actions/call_zome_fn: got call_result from ribosome::run_dna.
DEBUG 2019-12-27 03:04:43 [holochain::test-instance] call_zome_function/puid-e-e crates/core/src/nucleus/actions/call_zome_function.rs:117 actions/call_zome_fn: sending ReturnZomeFunctionResult action.
DEBUG 2019-12-27 03:04:43 [holochain::test-instance] call_zome_function/puid-e-e crates/core/src/nucleus/actions/call_zome_function.rs:126 actions/call_zome_fn: sent ReturnZomeFunctionResult action.
DEBUG 2019-12-27 03:04:43 [holochain_metrics::logger] http.worker00 crates/metrics/src/logger.rs:22 METRIC cogov.commit_collective.latency 185
DEBUG 2019-12-27 03:04:43 [rpc] http.worker00 /home/docker/project/.cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-14.0.1/src/io.rs:198 Response: {"jsonrpc":"2.0","result":"{\"Err\":{\"Internal\":\"{\\\"kind\\\":{\\\"ErrorGeneric\\\":\\\"Unknown entry type\\\"},\\\"file\\\":\\\"crates/core/src/nucleus/ribosome/runtime.rs\\\",\\\"line\\\":\\\"220\\\"}\"}}","id":"0"}.

Not sure what to make of this so any help would be appreciated.

Thank you,
Brian

Hi Brian! I recognise you! Good to see you here in the new forum. Quick scan over your zome function prompts the question, have you defined a link type called "collective_leger" from a collective address to a ledger address, or is that a typo? s/leger/ledger/

1 Like

Thank you & nice to see you again @pauldaoust. It’s nice to finally be hacking on some Holochain code. I did typo “ledger” & needed to add the link to the collective_def entry.

https://docs.rs/hdk/0.0.42-alpha5/hdk/macro.entry.html

Here is the diff:

1 Like

did that fix the problem you were seeing?

Yes it did! I marked your comment above as the solution. Thank you!

1 Like