plandex-ai/plandex · error
invalid value for --debug: %v
Error message
invalid value for --debug: %v
What it means
This error comes from autoDebugValue.Set, the flag.Value parser for the --debug flag. strconv.Atoi failed to parse the provided string as an integer, so the flag is rejected before any command runs. It is a pure input-validation error.
Source
Thrown at app/cli/cmd/plan_exec_helpers.go:238
// AutoDebugValue implements the flag.Value interface
type autoDebugValue struct {
value *int
}
func newAutoDebugValue(p *int) *autoDebugValue {
*p = 0 // Default to 0 (disabled)
return &autoDebugValue{p}
}
func (f *autoDebugValue) Set(s string) error {
if s == "" {
*f.value = defaultAutoDebugTries
return nil
}
v, err := strconv.Atoi(s)
if err != nil {
return fmt.Errorf("invalid value for --debug: %v", err)
}
if v <= 0 {
return fmt.Errorf("--debug value must be greater than 0")
}
*f.value = v
return nil
}
func (f *autoDebugValue) String() string {
if f.value == nil {
return "0"
}
return strconv.Itoa(*f.value)
}
func (f *autoDebugValue) Type() string {
return "int"
}View on GitHub (pinned to e2d772072e)
Solutions
- Pass a positive integer, e.g. --debug=3
- Remove quotes, spaces, or units from the value
- If no value is wanted, omit the flag (empty string falls back to defaultAutoDebugTries)
Example fix
// before plandex tell -f plan.md --debug=true // after plandex tell -f plan.md --debug=3
Defensive patterns
Strategy: validation
Validate before calling
v, err := strconv.Atoi(debugArg)
if err != nil || v <= 0 {
return fmt.Errorf("--debug must be a positive integer")
} Type guard
func isValidDebugVal(s string) bool {
v, err := strconv.Atoi(s)
return err == nil && v > 0
} Prevention
- Always pass --debug a positive integer
- Never quote or annotate the value (e.g. "3 tries")
- Remember the flag takes a count, not a boolean
- Let scripts default the value when unset
When it happens
Trigger: Passing --debug with a non-numeric value, e.g. --debug=abc, --debug=1.5, or --debug with trailing whitespace/units.
Common situations: Typing a word instead of a number, copying a value with quotes or spaces, assuming --debug takes a boolean like 'true' when it expects a positive integer retry count.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- --debug value must be greater than 0
- invalid context index: %s
- no context found with name: %s
- run command requires exactly one file path argument
- invalid value: %s
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/811f0afee8550d0b.
Report an issue: GitHub.