linera-io/linera-protocol · error

Signer error

Error message

Signer error

What it means

While processing wallet forget-keys, the CLI checks whether the keystore still holds the owner's key via keystore.contains_key(&owner).await. The .expect("Signer error") panics when the keystore backend itself fails — an I/O or remote error, not a 'key missing' result (missing keys are the false branch and only log a warning).

Source

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

            WalletCommand::SetDefault { chain_id } => {
                let start_time = Instant::now();
                options.wallet()?.set_default_chain(*chain_id)?;
                info!(
                    "Default chain set in {} ms",
                    start_time.elapsed().as_millis()
                );
                Ok(0)
            }

            WalletCommand::ForgetKeys { chain_id } => {
                let start_time = Instant::now();
                let owner = options.wallet()?.forget_keys(*chain_id)?;
                if !options
                    .keystore()?
                    .contains_key(&owner)
                    .await
                    .expect("Signer error")
                {
                    warn!("no keypair found in keystore for chain {chain_id}");
                }
                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"
                    );

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Check the keystore path and permissions: ls -l on the keystore file and confirm the process user can read it
  2. Point the command at the correct keystore with --keystore / LINERA_KEYSTORE_HOME if the wallet and keystore locations diverged
  3. For remote signer backends, verify connectivity/credentials of the signer service first
  4. Restore the keystore from backup or re-import the key, then re-run forget-keys

Example fix

# before
linera wallet forget-keys --chain-id 4ee5..c0de   # keystore path stale

# after
export LINERA_KEYSTORE_HOME=/var/lib/linera
ls -l /var/lib/linera/keystore.json   # readable?
linera wallet forget-keys --chain-id 4ee5..c0de
Defensive patterns

Strategy: validation

Validate before calling

# Pre-flight the keystore before wallet operations.
KS="${LINERA_KEYSTORE_HOME:-$HOME}/keystore.json"
test -r "$KS" || { echo "keystore missing/unreadable: $KS" >&2; exit 1; }
jq -e . "$KS" >/dev/null || { echo 'keystore is not valid JSON' >&2; exit 1; }

Prevention

When it happens

Trigger: Running `linera wallet forget-keys` when the keystore backend errors: the keystore file is unreadable/deleted/corrupted, permissions changed, or (with a remote/KMS-style keystore) the backing service or credentials are unavailable.

Common situations: LINERA_KEYSTORE_HOME / --keystore pointing to a moved or deleted file; read-only mounts in containers; keystore JSON corrupted by concurrent writers; environment where a hardware/cloud signer is unreachable.

Related errors


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