linera-io/linera-protocol · error

No default chain found for client

Error message

No default chain found for client

What it means

During benchmark setup, a client wallet has no default chain assigned. The multi-process benchmark iterates client wallets and calls client.default_chain() to seed new chains; Option::None here means wallet.json lists no default chain, so there is no chain to build on.

Source

Thrown at linera-service/src/cli/main.rs:1033

                            }

                            join_set
                                .join_all()
                                .await
                                .into_iter()
                                .collect::<Result<Vec<_>, _>>()?;

                            let chains_per_wallet = benchmark_options.num_chains;
                            info!(
                                "Creating {} chains per wallet ({} total chains)...",
                                chains_per_wallet,
                                chains_per_wallet * processes
                            );

                            let mut join_set = JoinSet::new();
                            for client in &clients {
                                let default_chain_id = client.default_chain().ok_or_else(|| {
                                    anyhow::anyhow!("No default chain found for client")
                                })?;
                                let client = client.clone();
                                join_set.spawn(async move {
                                    let mut chain_ids = Vec::new();
                                    for _ in 0..chains_per_wallet {
                                        let (chain_id, _owner) = client
                                            .open_chain_super_owner(
                                                default_chain_id,
                                                None,
                                                benchmark_options.tokens_per_chain,
                                            )
                                            .await?;
                                        chain_ids.push(chain_id);
                                    }
                                    Ok::<Vec<ChainId>, anyhow::Error>(chain_ids)
                                });
                            }

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Inspect the wallet (`linera wallet show --wallet <path>`) to list its chains and default.
  2. Set a default chain: `linera wallet set-default <chain-id> --wallet <path>`.
  3. If the wallet has no chains at all, re-initialize it (`linera wallet init --genesis ...`) before benchmarking.
  4. Generate benchmark wallets with the provided generator rather than by hand.

Example fix

# before: wallet used by the benchmark has chains but no default
linera-benchmark ... # -> "No default chain found for client"

# after: assign a default chain first
linera wallet show --wallet bench-wallet-0.json
linera wallet set-default <chain-id-from-show> --wallet bench-wallet-0.json
Defensive patterns

Strategy: validation

Validate before calling

let Some(default) = client.default_chain() else {
    anyhow::bail!(
        "wallet has no default chain — run `linera wallet set-default <id>` first"
    );
};

Prevention

When it happens

Trigger: Benchmark wallets created without a default (fresh wallet, chain list empty, or the default was forgotten/removed earlier); pointing the benchmark at a wallet file that was never fully initialized.

Common situations: Reusing wallet files from earlier benchmark runs that removed their chains; manually crafted wallet.json missing the default entry; forgetting the default chain with `linera wallet forget`/`set-default` before running benchmarks.

Related errors


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/ea6b6f7dda5677ad. Report an issue: GitHub.