cilium/cilium · warning
%w: expected key
Error message
%w: expected key
What it means
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.
Source
Thrown at pkg/kvstore/commands.go:73
value, err = tryTranscodeFromJSON(key, value)
if err != nil {
return nil, fmt.Errorf("could not transcode %q value: %w", key, err)
}
return nil, c.client.Update(s.Context(), key, value, false)
},
)
}
func (c cmds) delete() script.Cmd {
return script.Command(
script.CmdUsage{
Summary: "delete kvstore key-value",
Args: "key",
},
func(s *script.State, args ...string) (script.WaitFunc, error) {
if len(args) != 1 {
return nil, fmt.Errorf("%w: expected key", script.ErrUsage)
}
return nil, c.client.Delete(s.Context(), args[0])
},
)
}
func (c cmds) list() script.Cmd {
return script.Command(
script.CmdUsage{
Summary: "list kvstore key-value pairs",
Args: "prefix (output file)",
Flags: func(fs *pflag.FlagSet) {
fs.StringP("output", "o", "plain", "Output format. One of: (plain, json)")
fs.Bool("keys-only", false, "Only output the listed keys")
fs.Bool("values-only", false, "Only output the listed values")
},
},
func(s *script.State, args ...string) (script.WaitFunc, error) {View on GitHub (pinned to ac7b90affa)
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
Example fix
// before kvstore/del cilium/state some extra // after kvstore/del cilium/state
Defensive patterns
Strategy: validation
Validate before calling
if len(args) != 1 {
return fmt.Errorf("%w: expected key", script.ErrUsage)
} Prevention
- Pass exactly one quoted key argument
- Quote keys with spaces/special characters
- Confirm key names with kvstore/list first
When it happens
Trigger: Invoking the kvstore del script command with zero or multiple arguments.
Common situations: Pasting multi-word keys without quoting so the shell splits them into multiple args; forgetting the key entirely; passing a prefix with flags misplaced.
Related errors
- %w: expected key and value file
- --keys-only and --values-only are mutually exclusive
- group-ip or all flag must be specified
- could not read %q: %w
- could not transcode %q value: %w
AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31).
Data as JSON: /api/errors/195607eccbe82ac3.
Report an issue: GitHub.