{"record":{"id":"aaf6625aeaf5cf58","repo":"router-for-me/CLIProxyAPI","slug":"invalid-s-value-q","errorCode":null,"errorMessage":"invalid %s value %q","messagePattern":"invalid (.+?) value %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/command_line.go","lineNumber":209,"sourceCode":"\tkind string\n}\n\nfunc (v *commandLineFlagValue) String() string {\n\tif v == nil || v.host == nil {\n\t\treturn \"\"\n\t}\n\tv.host.mu.Lock()\n\tdefer v.host.mu.Unlock()\n\treturn v.host.commandLineFlags[v.name].value\n}\n\nfunc (v *commandLineFlagValue) Set(raw string) error {\n\tif v == nil || v.host == nil {\n\t\treturn nil\n\t}\n\tnormalized, okValue := normalizeCommandLineFlagValue(v.kind, raw)\n\tif !okValue {\n\t\treturn fmt.Errorf(\"invalid %s value %q\", v.kind, raw)\n\t}\n\tv.host.mu.Lock()\n\trecord, okRecord := v.host.commandLineFlags[v.name]\n\tif okRecord {\n\t\trecord.value = normalized\n\t\trecord.set = true\n\t\tv.host.commandLineFlags[v.name] = record\n\t\tv.host.commandLineHits[v.name] = struct{}{}\n\t}\n\tv.host.mu.Unlock()\n\treturn nil\n}\n\nfunc (v *commandLineFlagValue) IsBoolFlag() bool {\n\treturn v != nil && v.kind == \"bool\"\n}\n\n// HasTriggeredCommandLineFlags reports whether any plugin-owned flag was provided.","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/command_line.go#L191-L227","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\n./cli-proxy-api --plugin-verbose=1 --plugin-timeout=10\n\n# after\n./cli-proxy-api --plugin-verbose=true --plugin-timeout=10s","handlingStrategy":"validation","validationCode":"// Validate values against the flag's kind before launching\nvalid := map[string][]string{\n    \"verbose-mode\": {\"true\", \"false\"},\n}\nif !slices.Contains(valid[name], value) {\n    return fmt.Errorf(\"flag %s accepts %v, got %q\", name, valid[name], value)\n}","typeGuard":"func isValidFlagValue(kind, raw string) bool {\n    _, ok := normalizeCommandLineFlagValue(kind, raw)\n    return ok\n}","tryCatchPattern":"if err := flagSet.Parse(os.Args[1:]); err != nil {\n    log.Fatalf(\"bad flag: %v (run --help for accepted values)\", err) // fail fast with clear message\n}","preventionTips":["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."],"tags":["cli","flags","validation","pluginhost"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}