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 after trimming: it must be non-empty and contain no whitespace. Since config keys are TOML paths (optionally dotted), whitespace or an empty string cannot identify a config value, so the command refuses early.

Solutions

  1. Use the exact dotted config key, e.g. `atuin config get sync.records_enabled`.
  2. Check `atuin config` (or the docs) for valid key names — no spaces are allowed.
  3. Quote/unquote carefully in shell: ensure the variable holding the key is set and has no spaces.
  4. Trim stray whitespace from shell variables before passing them: `atuin config get "${KEY// /}"`.
  5. Inspect the server deployment for an unexpected 2FA-on-register policy if this is your own instance.

Example fix

// before
atuin config get "sync address"
atuin config get "$KEY"   # KEY is empty
// after
atuin config get auto_sync
KEY=auto_sync; atuin config get "$KEY"
Defensive patterns

Strategy: validation

Validate before calling

key="$1"
if [ -z "${key// }" ] || [[ "$key" =~ [[:space:]] ]]; then
  echo "invalid config key: '$key'" >&2; exit 1
fi
atuin config get "$key"

Prevention

When it happens

Trigger: Running `atuin config get ""`, `atuin config get " "`, or a key containing spaces/tabs such as `atuin config get "sync address"`.

Common situations: Shell variable interpolation producing an empty value (`atuin config get "$KEY"` with KEY unset); copy-pasted keys with stray spaces; mistaking a config description for its actual key name.

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@900007c480 (2026-09-19). Data as JSON: /api/errors/d7b7dba8e009ee58. Report an issue: GitHub.

Appendix: 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 900007c480)