Hmbown/CodeWhale · warning

key not found: {key}

Error message

key not found: {key}

What it means

`codewhale config get <key>` looks the key up through the config store's display-value map and bails with `key not found: <key>` when nothing is set. This distinguishes 'unset key' from a value that prints as empty, and it means the exact key path (including section prefix and casing) has no entry in config.toml or any layered source.

Source

Thrown at crates/cli/src/lib.rs:4101

                "config.toml at {} no longer contains api_key entries for migrated providers.",
                store.path().display()
            );
        }
    }
    for w in warnings {
        eprintln!("warning: {w}");
    }
    Ok(())
}

fn run_config_command(store: &mut ConfigStore, command: ConfigCommand) -> Result<()> {
    match command {
        ConfigCommand::Get { key } => {
            if let Some(value) = store.config.get_display_value(&key) {
                println!("{value}");
                return Ok(());
            }
            bail!("key not found: {key}");
        }
        ConfigCommand::Set { key, value } => {
            clear_recorded_telemetry_opt_out_if_reenabled(&key, &value)?;
            store.config.set_value(&key, &value)?;
            store.save()?;
            println!("set {key}");
            Ok(())
        }
        ConfigCommand::Unset { key } => {
            store.config.unset_value(&key)?;
            store.save()?;
            println!("unset {key}");
            Ok(())
        }
        ConfigCommand::List => {
            // Configured truth, not live-session truth (DGF-01): a running
            // session keeps the route it resolved at launch, so these values
            // must not be read as "what the current session is serving".

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. List what actually exists: inspect config.toml (or the config listing command) to copy the exact key spelling
  2. Set the key first with `codewhale config set <key> <value>`, then get it
  3. Check key syntax: use the full dotted path with correct section and hyphen/underscore form

Example fix

# before
$ codewhale config get default-model
# key not found: default-model

# after
$ codewhale config get default_text_model
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
key="default_text_model"
value="$(codewhale config get "$key" 2>/dev/null)" || { echo "$key not set; setting default" >&2; codewhale config set "$key" auto; }
echo "value: $value"

Try / catch

# shell: treat exit != 0 as 'unset' rather than fatal
if ! value=$(codewhale config get "$key" 2>/dev/null); then
  echo "key unset: $key" >&2
  value="<default>"
fi

Prevention

When it happens

Trigger: `codewhale config get <key>` for a misspelled key, a key never set, a key from documentation for a different version, or wrong section-prefix syntax (e.g. `model` vs `default_text_model`, missing `provider.x.` prefix).

Common situations: Copy-pasting key names from older docs or other machines' configs; assuming a default exists for an optional key; casing/separator mistakes in dotted key paths.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/dea3bbf1b83a6854. Report an issue: GitHub.