influxdata/influxdb · error · anyhow::Error

must be formatted as "key=value"

Error message

must be formatted as "key=value"

What it means

SeparatedKeyValue<K, V> is the clap parser for repeated key=value CLI options in the influxdb3 CLI — concretely --trigger-arguments on `influxdb3 create trigger` and --input-arguments on `influxdb3 test trigger`. Its FromStr splits the token once on '=' (the default SEPARATOR); if split_once returns None the token contained no '=' at all and this error is produced. Values may themselves contain '=' because only the first separator splits.

Source

Thrown at influxdb3_commands/src/common.rs:76

// A clap argument provided as a key/value pair separated by `SEPARATOR`, which by default is a '='
#[derive(Debug, Clone)]
pub struct SeparatedKeyValue<K, V, const SEPARATOR: char = '='>(pub (K, V));

impl<K, V, const SEPARATOR: char> FromStr for SeparatedKeyValue<K, V, SEPARATOR>
where
    K: FromStr<Err: Into<anyhow::Error>>,
    V: FromStr<Err: Into<anyhow::Error>>,
{
    type Err = anyhow::Error;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let (key, value) = s
            // we only split once because the structure of our input is a SEPARATOR-separated tuple
            // and we need to allow the SEPARATOR value to be included multiple times in value side
            // of the tuple
            .split_once(SEPARATOR)
            .ok_or_else(|| anyhow::anyhow!("must be formatted as \"key=value\""))?;

        Ok(Self((
            key.parse().map_err(Into::into)?,
            value.parse().map_err(Into::into)?,
        )))
    }
}

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum DataType {
    Int64,
    Uint64,
    Float64,
    Utf8,
    Bool,
}

#[derive(Debug, PartialEq, Eq, thiserror::Error)]

View on GitHub (pinned to d28e26e048)

Solutions

  1. Provide every argument as KEY=VALUE, e.g. --trigger-arguments host=example.com port=8080
  2. Quote each token in the shell so nothing is re-parsed: "--trigger-arguments" "key=my=value" (later '=' stay in the value)
  3. Check for typos: empty values (`key=`) are fine, but a missing '=' is not

Example fix

# before
influxdb3 create trigger --database db --plugin-filename p.py \
  --trigger-arguments filename   # no '=' -> must be formatted as "key=value"

# after
influxdb3 create trigger --database db --plugin-filename p.py \
  --trigger-arguments "filename=data.csv"
Defensive patterns

Strategy: validation

Validate before calling

# shell: validate every key=value argument before invoking the CLI
for arg in "${TRIGGER_ARGS[@]}"; do
  [[ "$arg" == *=* ]] || { echo "bad argument '$arg': expected key=value" >&2; exit 1; }
done

Prevention

When it happens

Trigger: Passing a token without an equals sign: `influxdb3 create trigger ... --trigger-arguments foo`, or `--input-arguments config.json`. Also shell quoting that strips the '=' (e.g. unquoted strings mangled by an outer parser).

Common situations: Assuming the flag takes a filename or bare value instead of KEY=VALUE pairs; copy-pasting from docs or wikis where formatting dropped the '='; scripts building the argument list with a missing value component.

Related errors


AI-assisted analysis of influxdata/influxdb@d28e26e048 (2026-08-16). Data as JSON: /api/errors/7c02d943ca54a59e. Report an issue: GitHub.