linera-io/linera-protocol · warning
nonexistent chain `{chain_id}`
Error message
nonexistent chain `{chain_id}` What it means
`linera wallet forget <chain>` was asked to remove a chain that the wallet does not track: wallet.remove() returned None. The earlier guard already blocks forgetting the default chain, so this error specifically means the chain id is absent — already forgotten, never known to this wallet, or mistyped.
Source
Thrown at linera-service/src/cli/main.rs:2655
info!(
"Chain keys forgotten in {} ms",
start_time.elapsed().as_millis()
);
Ok(0)
}
WalletCommand::ForgetChain { chain_id } => {
let start_time = Instant::now();
let wallet = options.wallet()?;
if wallet.default_chain() == Some(*chain_id) {
anyhow::bail!(
"cannot forget the default chain `{chain_id}`; \
switch to another chain with `wallet set-default` first"
);
}
wallet
.remove(*chain_id)?
.ok_or_else(|| anyhow::anyhow!("nonexistent chain `{chain_id}`"))?;
info!("Chain forgotten in {} ms", start_time.elapsed().as_millis());
Ok(0)
}
WalletCommand::Init {
genesis_config_path,
faucet,
testing_prng_seed,
} => {
let start_time = Instant::now();
let genesis_config: GenesisConfig = match (genesis_config_path, faucet) {
(None, None) => {
anyhow::bail!("please specify one of `--faucet` or `--genesis`.")
}
(Some(genesis_config_path), _) => util::read_json(genesis_config_path)?,
(None, Some(url)) => {
let faucet = cli_wrappers::Faucet::new(url.clone());
let version_info = faucetView on GitHub (pinned to 6c226ddcb3)
Solutions
- List what this wallet actually tracks: `linera wallet show`.
- Copy the exact chain id from that listing and retry the forget command.
- Confirm you are operating on the right wallet (--wallet path).
- In scripts, treat this error as a no-op (chain already absent) if idempotency is desired.
Example fix
# before: chain id not present in this wallet linera wallet forget e5…9f # -> "nonexistent chain `e5…9f`" # after: list chains, forget an existing one linera wallet show linera wallet forget <chain-id-from-show>
Defensive patterns
Strategy: validation
Validate before calling
if !wallet.chain_ids().contains(chain_id) {
anyhow::bail!(
"chain {chain_id} is not in this wallet — `linera wallet show` lists known chains"
);
} Prevention
- Always list chains with `linera wallet show` and copy the id from the output.
- In cleanup scripts, treat 'nonexistent chain' as success (idempotent forget).
- Confirm the --wallet path when managing several wallets.
When it happens
Trigger: Running forget twice; passing a chain id from a different wallet file; a typo or truncated chain id; wallet state where the chain was removed but the caller's notes were not updated.
Common situations: Idempotent-looking scripts that forget chains on cleanup; operators managing several wallet files and mixing up chain ids; copy-paste of ChainId with missing/extra characters.
Related errors
- Chain {chain_id} not found.
- Wallet already exists: {}
- No default chain found for client
- The chain with the ID returned by the faucet is not owned by
- No wallet found at {}. Please initialize a wallet first, e.g
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/12df33466012160b.
Report an issue: GitHub.