{"record":{"id":"195607eccbe82ac3","repo":"cilium/cilium","slug":"w-expected-key","errorCode":null,"errorMessage":"%w: expected key","messagePattern":"%w: expected key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/kvstore/commands.go","lineNumber":73,"sourceCode":"\t\t\tvalue, err = tryTranscodeFromJSON(key, value)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"could not transcode %q value: %w\", key, err)\n\t\t\t}\n\n\t\t\treturn nil, c.client.Update(s.Context(), key, value, false)\n\t\t},\n\t)\n}\n\nfunc (c cmds) delete() script.Cmd {\n\treturn script.Command(\n\t\tscript.CmdUsage{\n\t\t\tSummary: \"delete kvstore key-value\",\n\t\t\tArgs:    \"key\",\n\t\t},\n\t\tfunc(s *script.State, args ...string) (script.WaitFunc, error) {\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn nil, fmt.Errorf(\"%w: expected key\", script.ErrUsage)\n\t\t\t}\n\t\t\treturn nil, c.client.Delete(s.Context(), args[0])\n\t\t},\n\t)\n}\n\nfunc (c cmds) list() script.Cmd {\n\treturn script.Command(\n\t\tscript.CmdUsage{\n\t\t\tSummary: \"list kvstore key-value pairs\",\n\t\t\tArgs:    \"prefix (output file)\",\n\t\t\tFlags: func(fs *pflag.FlagSet) {\n\t\t\t\tfs.StringP(\"output\", \"o\", \"plain\", \"Output format. One of: (plain, json)\")\n\t\t\t\tfs.Bool(\"keys-only\", false, \"Only output the listed keys\")\n\t\t\t\tfs.Bool(\"values-only\", false, \"Only output the listed values\")\n\t\t\t},\n\t\t},\n\t\tfunc(s *script.State, args ...string) (script.WaitFunc, error) {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/kvstore/commands.go#L55-L91","documentation":"The kvstore 'del' script command requires exactly one argument (the key). With any other argument count it returns script.ErrUsage wrapped with 'expected key', a usage error surfaced to the script engine.","triggerScenarios":"Invoking the kvstore del script command with zero or multiple arguments.","commonSituations":"Pasting multi-word keys without quoting so the shell splits them into multiple args; forgetting the key entirely; passing a prefix with flags misplaced.","solutions":["Pass exactly one argument: the key to delete","Quote keys containing spaces or special characters","Use the list command to confirm the exact key name"],"exampleFix":"// before\nkvstore/del cilium/state some extra\n// after\nkvstore/del cilium/state","handlingStrategy":"validation","validationCode":"if len(args) != 1 {\n    return fmt.Errorf(\"%w: expected key\", script.ErrUsage)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass exactly one quoted key argument","Quote keys with spaces/special characters","Confirm key names with kvstore/list first"],"tags":["cli","usage","kvstore","script"],"backgroundTag":"cli-usage-error","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}