router-for-me/CLIProxyAPI · error
invalid %s value %q
Error message
invalid %s value %q
What it means
commandLineFlagValue.Set parses a raw string via normalizeCommandLineFlagValue for the flag's declared kind and rejects values that do not parse. The error names the kind (e.g. bool, duration, int, string-enum) and the offending raw value. This surfaces through Go's flag package as an invalid command-line flag value.
Source
Thrown at internal/pluginhost/command_line.go:209
kind string
}
func (v *commandLineFlagValue) String() string {
if v == nil || v.host == nil {
return ""
}
v.host.mu.Lock()
defer v.host.mu.Unlock()
return v.host.commandLineFlags[v.name].value
}
func (v *commandLineFlagValue) Set(raw string) error {
if v == nil || v.host == nil {
return nil
}
normalized, okValue := normalizeCommandLineFlagValue(v.kind, raw)
if !okValue {
return fmt.Errorf("invalid %s value %q", v.kind, raw)
}
v.host.mu.Lock()
record, okRecord := v.host.commandLineFlags[v.name]
if okRecord {
record.value = normalized
record.set = true
v.host.commandLineFlags[v.name] = record
v.host.commandLineHits[v.name] = struct{}{}
}
v.host.mu.Unlock()
return nil
}
func (v *commandLineFlagValue) IsBoolFlag() bool {
return v != nil && v.kind == "bool"
}
// HasTriggeredCommandLineFlags reports whether any plugin-owned flag was provided.View on GitHub (pinned to 78f0c4079e)
Solutions
- Re-read the error text: it states the expected kind and the exact raw value received — correct the flag argument to match the kind.
- For bool flags use true/false; for duration use Go duration syntax (10s, 1m30s); for enums use one of the plugin's documented values.
- Check the plugin's flag registration (name and kind) to confirm the accepted format, especially after upgrading the plugin.
- Quote flag values in scripts to prevent shell splitting.
Example fix
# before ./cli-proxy-api --plugin-verbose=1 --plugin-timeout=10 # after ./cli-proxy-api --plugin-verbose=true --plugin-timeout=10s
Defensive patterns
Strategy: validation
Validate before calling
// Validate values against the flag's kind before launching
valid := map[string][]string{
"verbose-mode": {"true", "false"},
}
if !slices.Contains(valid[name], value) {
return fmt.Errorf("flag %s accepts %v, got %q", name, valid[name], value)
} Type guard
func isValidFlagValue(kind, raw string) bool {
_, ok := normalizeCommandLineFlagValue(kind, raw)
return ok
} Try / catch
if err := flagSet.Parse(os.Args[1:]); err != nil {
log.Fatalf("bad flag: %v (run --help for accepted values)", err) // fail fast with clear message
} Prevention
- Generate launch scripts from --help output so values always match declared kinds.
- Use Go-native formats: bare true/false for bools, 10s/1m for durations.
- Re-validate flag values after plugin upgrades that may change accepted enums.
When it happens
Trigger: Launching the binary with a plugin-registered command-line flag whose argument cannot be normalized for its kind: --some-flag=maybe for a bool flag, --timeout=10x for a duration, or an enum flag given an unknown option.
Common situations: Typos in launch scripts or systemd units; passing an empty value (= with nothing after); version change that altered a flag's accepted kind or enum set; quoting issues in shell wrappers stripping or mangling the value.
Related errors
- count must be a positive integer
- Codex live multipart boundary is missing
- Codex live multipart body requires an sdp field
- invalid auth file name
- auth file name must end with .json
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/aaf6625aeaf5cf58.
Report an issue: GitHub.