{"record":{"id":"dea3bbf1b83a6854","repo":"Hmbown/CodeWhale","slug":"key-not-found-key","errorCode":null,"errorMessage":"key not found: {key}","messagePattern":"key not found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/cli/src/lib.rs","lineNumber":4101,"sourceCode":"                \"config.toml at {} no longer contains api_key entries for migrated providers.\",\n                store.path().display()\n            );\n        }\n    }\n    for w in warnings {\n        eprintln!(\"warning: {w}\");\n    }\n    Ok(())\n}\n\nfn run_config_command(store: &mut ConfigStore, command: ConfigCommand) -> Result<()> {\n    match command {\n        ConfigCommand::Get { key } => {\n            if let Some(value) = store.config.get_display_value(&key) {\n                println!(\"{value}\");\n                return Ok(());\n            }\n            bail!(\"key not found: {key}\");\n        }\n        ConfigCommand::Set { key, value } => {\n            clear_recorded_telemetry_opt_out_if_reenabled(&key, &value)?;\n            store.config.set_value(&key, &value)?;\n            store.save()?;\n            println!(\"set {key}\");\n            Ok(())\n        }\n        ConfigCommand::Unset { key } => {\n            store.config.unset_value(&key)?;\n            store.save()?;\n            println!(\"unset {key}\");\n            Ok(())\n        }\n        ConfigCommand::List => {\n            // Configured truth, not live-session truth (DGF-01): a running\n            // session keeps the route it resolved at launch, so these values\n            // must not be read as \"what the current session is serving\".","sourceCodeStart":4083,"sourceCodeEnd":4119,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/cli/src/lib.rs#L4083-L4119","documentation":"`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.","triggerScenarios":"`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).","commonSituations":"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.","solutions":["List what actually exists: inspect config.toml (or the config listing command) to copy the exact key spelling","Set the key first with `codewhale config set <key> <value>`, then get it","Check key syntax: use the full dotted path with correct section and hyphen/underscore form"],"exampleFix":"# before\n$ codewhale config get default-model\n# key not found: default-model\n\n# after\n$ codewhale config get default_text_model","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nkey=\"default_text_model\"\nvalue=\"$(codewhale config get \"$key\" 2>/dev/null)\" || { echo \"$key not set; setting default\" >&2; codewhale config set \"$key\" auto; }\necho \"value: $value\"","typeGuard":null,"tryCatchPattern":"# shell: treat exit != 0 as 'unset' rather than fatal\nif ! value=$(codewhale config get \"$key\" 2>/dev/null); then\n  echo \"key unset: $key\" >&2\n  value=\"<default>\"\nfi","preventionTips":["Copy key names from your own config.toml (or the config listing) instead of docs","In scripts, branch on the command's exit status to distinguish unset from empty"],"tags":["config","key-not-found","cli","toml"],"backgroundTag":"unknown-config-key","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}