linera-io/linera-protocol · error · anyhow::Error

Cannot specify both --owned and a chain ID

Error message

Cannot specify both --owned and a chain ID

What it means

`linera wallet show` selects chains either by an explicit chain ID argument or by the --owned flag (all chains owned by this wallet). Supplying both is contradictory, so the CLI rejects it right after loading the wallet, before printing anything.

Source

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

                Ok(0)
            }
        },

        ClientCommand::Storage(command) => {
            Ok(options.run_with_store(DatabaseToolJob(command)).await?)
        }

        ClientCommand::Wallet(wallet_command) => match wallet_command {
            WalletCommand::Show {
                chain_id,
                short,
                owned,
            } => {
                let wallet_path = options.wallet_path()?;
                tracing::info!("Reading wallet from file: {}", wallet_path.display());
                let wallet = options.wallet()?;
                let chain_ids = if let Some(chain_id) = chain_id {
                    ensure!(!owned, "Cannot specify both --owned and a chain ID");
                    vec![*chain_id]
                } else if *owned {
                    wallet.owned_chain_ids()
                } else {
                    wallet.chain_ids()
                };
                if *short {
                    for chain_id in chain_ids {
                        println!("{chain_id}");
                    }
                } else {
                    linera_wallet_json::display::pretty_print(&wallet, chain_ids);
                }
                Ok(0)
            }

            WalletCommand::SetDefault { chain_id } => {
                let start_time = Instant::now();

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Use one or the other: `linera wallet show <CHAIN_ID>` or `linera wallet show --owned`
  2. Fix the script or alias that concatenates both options

Example fix

# before
$ linera wallet show --owned e50c...
error: Cannot specify both --owned and a chain ID

# after
$ linera wallet show e50c...
Defensive patterns

Strategy: validation

Validate before calling

if owned && chain_id.is_some() {
    eprintln!("use either --owned or a chain ID, not both");
    std::process::exit(2);
}

Prevention

When it happens

Trigger: Running `linera wallet show --owned <CHAIN_ID>` — a chain ID argument together with the --owned flag.

Common situations: Copy-pasted command lines that accumulated flags; scripts or aliases that always pass --owned and then append a chain id argument.

Related errors


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