{"record":{"id":"7c02d943ca54a59e","repo":"influxdata/influxdb","slug":"must-be-formatted-as-key-value","errorCode":null,"errorMessage":"must be formatted as \"key=value\"","messagePattern":"must be formatted as \"key=value\"","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"influxdb3_commands/src/common.rs","lineNumber":76,"sourceCode":"\n// A clap argument provided as a key/value pair separated by `SEPARATOR`, which by default is a '='\n#[derive(Debug, Clone)]\npub struct SeparatedKeyValue<K, V, const SEPARATOR: char = '='>(pub (K, V));\n\nimpl<K, V, const SEPARATOR: char> FromStr for SeparatedKeyValue<K, V, SEPARATOR>\nwhere\n    K: FromStr<Err: Into<anyhow::Error>>,\n    V: FromStr<Err: Into<anyhow::Error>>,\n{\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        let (key, value) = s\n            // we only split once because the structure of our input is a SEPARATOR-separated tuple\n            // and we need to allow the SEPARATOR value to be included multiple times in value side\n            // of the tuple\n            .split_once(SEPARATOR)\n            .ok_or_else(|| anyhow::anyhow!(\"must be formatted as \\\"key=value\\\"\"))?;\n\n        Ok(Self((\n            key.parse().map_err(Into::into)?,\n            value.parse().map_err(Into::into)?,\n        )))\n    }\n}\n\n#[derive(Debug, Copy, Clone, PartialEq, Eq)]\npub enum DataType {\n    Int64,\n    Uint64,\n    Float64,\n    Utf8,\n    Bool,\n}\n\n#[derive(Debug, PartialEq, Eq, thiserror::Error)]","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_commands/src/common.rs#L58-L94","documentation":"Raised by FromStr::from_str for a key=value tuple type (e.g. a tag or field specification parsed from a CLI argument). The input string did not contain the SEPARATOR ('='), so split_once fails and this anyhow error is returned. The whole argument is rejected before key/value parsing is even attempted.","triggerScenarios":"Passing a --tag or --field style CLI argument without an '=' separator, e.g. `--tag host` instead of `--tag host=server01`, or passing an empty/whitespace-only value to such an option.","commonSituations":"Typos when writing line-protocol-like arguments on the command line; shell quoting stripping the '=' is rare but possible; forgetting that multiple '=' are allowed in the value but at least one is required; scripted invocations building args from env vars that are empty.","solutions":["Re-run the command with each tag/field argument formatted as key=value, e.g. --tag host=server01.","Check shell quoting so the '=' is passed through intact (quote the whole argument if it contains spaces).","Inspect scripted/env-driven invocations for empty variables producing bare keys.","Wrap key/value pairs containing '=' in the value (allowed; only the first '=' splits)."],"exampleFix":"// before\ninfluxdb3 write --database mydb --tag host --tag-location us\n// after\ninfluxdb3 write --database mydb --tag host=server01 --tag-location=us","handlingStrategy":"validation","validationCode":"fn validate_kv(arg: &str) -> Result<(), String> {\n    if arg.split_once('=').is_none() {\n        return Err(format!(\"argument '{arg}' must be formatted as key=value\"));\n    }\n    Ok(())\n}\n// run validate_kv(tag_arg)? before invoking the CLI/library","typeGuard":"fn looks_like_key_value(s: &str) -> bool { s.contains('=') && !s.starts_with('=') }","tryCatchPattern":null,"preventionTips":["Always pass tag/field arguments as key=value pairs.","Quote arguments containing spaces or '=' in values.","Validate env-driven argument strings before spawning the CLI.","Remember only the first '=' splits; extra '=' belong to the value."],"tags":["cli","parsing","rust"],"backgroundTag":"invalid-argument-format","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}