{"record":{"id":"d7b7dba8e009ee58","repo":"atuinsh/atuin","slug":"config-key-must-be-non-empty-and-must-not-contain","errorCode":null,"errorMessage":"Config key must be non-empty and must not contain whitespace","messagePattern":"Config key must be non-empty and must not contain whitespace","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/config.rs","lineNumber":58,"sourceCode":"#[derive(Args, Debug)]\npub struct GetCmd {\n    /// The configuration key to get\n    pub key: String,\n\n    /// Print the value after defaults and overrides are applied\n    #[arg(long, short)]\n    pub resolved: bool,\n\n    /// Print both the config file value and the resolved value\n    #[arg(long, short)]\n    pub verbose: bool,\n}\n\nimpl GetCmd {\n    pub async fn run(&self, _settings: &Settings) -> Result<()> {\n        let key = self.key.trim();\n        if key.is_empty() || key.contains(char::is_whitespace) {\n            eyre::bail!(\"Config key must be non-empty and must not contain whitespace\");\n        }\n\n        if self.verbose {\n            println!(\"Config file:\");\n            self.print_current_value(key, \"  \").await?;\n            println!(\"\\nResolved:\");\n            Self::print_effective_value(key, \"  \");\n            return Ok(());\n        }\n\n        if self.resolved {\n            Self::print_effective_value(key, \"\");\n        } else {\n            self.print_current_value(key, \"\").await?;\n        }\n\n        Ok(())\n    }","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/config.rs#L40-L76","documentation":"`atuin config get <key>` validates the requested key before doing a TOML lookup. The key must contain at least one non-whitespace character and no internal whitespace, otherwise the command bails. This prevents nonsense lookups that could never match a config path.","triggerScenarios":"Running `atuin config get` with an empty/whitespace-only key (e.g. `atuin config get \"\"` or `atuin config get \"  \"`), or a key containing spaces such as `atuin config get \"search mode\"`.","commonSituations":"Shell variable interpolating to empty (`atuin config get \"$KEY\"` with unset KEY); accidentally passing two words as one argument with quotes mis-placed; copy-pasting a config path with a stray space.","solutions":["Quote dotted keys as a single argument: `atuin config get search.mode`.","Ensure the shell variable holding the key is set and non-blank before invoking.","Use underscores/dots per the actual config schema, not spaces (e.g. `search_mode`, `search.mode` depending on nesting).","Run `atuin config get` with `--verbose` after fixing to inspect the resolved value."],"exampleFix":"// before\nKEY=\"search mode\"\natuin config get \"$KEY\"   # error: Config key must be non-empty...\n// after\natuin config get search.mode","handlingStrategy":"validation","validationCode":"KEY=\"search.mode\"\n[[ -z \"${KEY//[[:space:]]/}\" || \"$KEY\" =~ [[:space:]] ]] && { echo \"invalid config key: '$KEY'\" >&2; exit 1; }\natuin config get \"$KEY\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote the dotted key as a single argument.","Check shell variables for emptiness before interpolation.","Use dots, never spaces, for config paths."],"tags":["cli","config","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}