{"record":{"id":"01f849542953d752","repo":"linera-io/linera-protocol","slug":"cannot-specify-both-owned-and-a-chain-id","errorCode":null,"errorMessage":"Cannot specify both --owned and a chain ID","messagePattern":"Cannot specify both --owned and a chain ID","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"linera-service/src/cli/main.rs","lineNumber":2599,"sourceCode":"                Ok(0)\n            }\n        },\n\n        ClientCommand::Storage(command) => {\n            Ok(options.run_with_store(DatabaseToolJob(command)).await?)\n        }\n\n        ClientCommand::Wallet(wallet_command) => match wallet_command {\n            WalletCommand::Show {\n                chain_id,\n                short,\n                owned,\n            } => {\n                let wallet_path = options.wallet_path()?;\n                tracing::info!(\"Reading wallet from file: {}\", wallet_path.display());\n                let wallet = options.wallet()?;\n                let chain_ids = if let Some(chain_id) = chain_id {\n                    ensure!(!owned, \"Cannot specify both --owned and a chain ID\");\n                    vec![*chain_id]\n                } else if *owned {\n                    wallet.owned_chain_ids()\n                } else {\n                    wallet.chain_ids()\n                };\n                if *short {\n                    for chain_id in chain_ids {\n                        println!(\"{chain_id}\");\n                    }\n                } else {\n                    linera_wallet_json::display::pretty_print(&wallet, chain_ids);\n                }\n                Ok(0)\n            }\n\n            WalletCommand::SetDefault { chain_id } => {\n                let start_time = Instant::now();","sourceCodeStart":2581,"sourceCodeEnd":2617,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli/main.rs#L2581-L2617","documentation":"`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.","triggerScenarios":"Running `linera wallet show --owned <CHAIN_ID>` — a chain ID argument together with the --owned flag.","commonSituations":"Copy-pasted command lines that accumulated flags; scripts or aliases that always pass --owned and then append a chain id argument.","solutions":["Use one or the other: `linera wallet show <CHAIN_ID>` or `linera wallet show --owned`","Fix the script or alias that concatenates both options"],"exampleFix":"# before\n$ linera wallet show --owned e50c...\nerror: Cannot specify both --owned and a chain ID\n\n# after\n$ linera wallet show e50c...","handlingStrategy":"validation","validationCode":"if owned && chain_id.is_some() {\n    eprintln!(\"use either --owned or a chain ID, not both\");\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep CLI invocations in scripts single-purpose","Check `linera wallet show --help` before combining selection flags"],"tags":["cli","wallet","argument-validation","usage"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}