atuinsh/atuin · error

Config key must be non-empty and must not contain whitespace

Error message

Config key must be non-empty and must not contain whitespace

What it means

`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.

Source

Thrown at crates/atuin/src/command/client/config.rs:58

#[derive(Args, Debug)]
pub struct GetCmd {
    /// The configuration key to get
    pub key: String,

    /// Print the value after defaults and overrides are applied
    #[arg(long, short)]
    pub resolved: bool,

    /// Print both the config file value and the resolved value
    #[arg(long, short)]
    pub verbose: bool,
}

impl GetCmd {
    pub async fn run(&self, _settings: &Settings) -> Result<()> {
        let key = self.key.trim();
        if key.is_empty() || key.contains(char::is_whitespace) {
            eyre::bail!("Config key must be non-empty and must not contain whitespace");
        }

        if self.verbose {
            println!("Config file:");
            self.print_current_value(key, "  ").await?;
            println!("\nResolved:");
            Self::print_effective_value(key, "  ");
            return Ok(());
        }

        if self.resolved {
            Self::print_effective_value(key, "");
        } else {
            self.print_current_value(key, "").await?;
        }

        Ok(())
    }

View on GitHub (pinned to c0c717ab04)

Solutions

  1. Quote dotted keys as a single argument: `atuin config get search.mode`.
  2. Ensure the shell variable holding the key is set and non-blank before invoking.
  3. Use underscores/dots per the actual config schema, not spaces (e.g. `search_mode`, `search.mode` depending on nesting).
  4. Run `atuin config get` with `--verbose` after fixing to inspect the resolved value.

Example fix

// before
KEY="search mode"
atuin config get "$KEY"   # error: Config key must be non-empty...
// after
atuin config get search.mode
Defensive patterns

Strategy: validation

Validate before calling

KEY="search.mode"
[[ -z "${KEY//[[:space:]]/}" || "$KEY" =~ [[:space:]] ]] && { echo "invalid config key: '$KEY'" >&2; exit 1; }
atuin config get "$KEY"

Prevention

When it happens

Trigger: 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"`.

Common situations: 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.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of atuinsh/atuin@c0c717ab04 (2026-09-12). Data as JSON: /api/errors/d7b7dba8e009ee58. Report an issue: GitHub.