{"record":{"id":"e06c4c4447a516c3","repo":"hashicorp/nomad","slug":"invalid-key-value-pair-for-topic-s","errorCode":null,"errorMessage":"Invalid key value pair for topic: %s","messagePattern":"Invalid key value pair for topic: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/operator_debug.go","lineNumber":1923,"sourceCode":"\t}\n\n\treturn topics, mErrs.ErrorOrNil()\n}\n\nfunc parseTopic(input string) (string, string, error) {\n\tvar topic, filter string\n\n\tparts := strings.Split(input, \":\")\n\tswitch len(parts) {\n\tcase 1:\n\t\t// infer wildcard if only given a topic\n\t\ttopic = input\n\t\tfilter = \"*\"\n\tcase 2:\n\t\ttopic = parts[0]\n\t\tfilter = parts[1]\n\tdefault:\n\t\treturn \"\", \"\", fmt.Errorf(\"Invalid key value pair for topic: %s\", topic)\n\t}\n\n\treturn cases.Title(language.English).String(topic), filter, nil\n}\n\nfunc allTopics() map[api.Topic][]string {\n\treturn map[api.Topic][]string{\"*\": {\"*\"}}\n}\n\n// topicsFromString parses a comma separated list into a topicMap\nfunc topicsFromString(topicList string) (map[api.Topic][]string, error) {\n\tif topicList == \"none\" {\n\t\treturn nil, nil\n\t}\n\tif topicList == \"all\" {\n\t\treturn allTopics(), nil\n\t}\n","sourceCodeStart":1905,"sourceCodeEnd":1941,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/operator_debug.go#L1905-L1941","documentation":"This error is returned by the topic/filter parsing helper in `nomad operator debug` when the user-supplied topic spec (a \"topic=filter\" key/value pair) does not split into the expected 1 or 2 parts. Only formats `topic` and `topic=filter` are accepted; anything with more than one `=` separator (or otherwise malformed input) hits the default case. The topic portion is then title-cased to match the api.Topic enum.","triggerScenarios":"Running `nomad operator debug -topic ...` (or the equivalent API/wrapper call) with a topic string like `a=b=c` or any spec that splits into 3+ parts via strings.Split on '='.","commonSituations":"Typing an extra '=' in a filter value, pasting a key=value pair containing an encoded '=' (e.g. base64 or URL params) into the filter, or scripting the flag with improperly quoted shell variables containing '='.","solutions":["Remove or escape any extra '=' characters so the spec contains at most one '=' (format: topic=filter).","Use just the topic name with no '=' to apply the default '*' filter.","Quote the flag value in your shell and verify the variable contents do not contain stray '=' characters.","Check the topic spelling; it is title-cased (e.g. evaluation, node, deployment) before being matched against api.Topic."],"exampleFix":"// before\n// -topic=\"Evaluation=*extra=1\"\n// after\n// -topic=\"Evaluation=*\"","handlingStrategy":"validation","validationCode":"parts := strings.Split(spec, \"=\")\nif len(parts) > 2 {\n    return fmt.Errorf(\"topic spec must be 'topic' or 'topic=filter', got %q\", spec)\n}\ntopic, filter := parts[0], \"*\"\nif len(parts) == 2 {\n    filter = parts[1]\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build topic specs as 'topic=filter' with a single '='.","Quote shell flag values to avoid stray '=' from variables.","Use only known topic names (evaluation, node, deployment, etc.) so the title-cased value matches api.Topic."],"tags":["cli","argument-parsing","nomad"],"backgroundTag":"invalid-argument-format","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}