go-delve/delve · error
wrong argument to "config debug-info-directories"
Error message
wrong argument to "config debug-info-directories"
What it means
Thrown by configureSetDebugInfoDirectories when the first argument is not one of the recognized operations `-clear`, `-add`, or `-rm`. The command's switch statement hits its default branch because the operation name is misspelled or an unsupported value was passed.
Source
Thrown at pkg/terminal/config.go:184
}
t.conf.DebugInfoDirectories = append(t.conf.DebugInfoDirectories, v[1])
case "-rm":
if len(v) < 2 {
return errors.New("not enough arguments to \"config debug-info-directories\"")
}
found := false
for i := range t.conf.DebugInfoDirectories {
if t.conf.DebugInfoDirectories[i] == v[1] {
found = true
t.conf.DebugInfoDirectories = append(t.conf.DebugInfoDirectories[:i], t.conf.DebugInfoDirectories[i+1:]...)
break
}
}
if !found {
return fmt.Errorf("could not find %q in debug-info-directories", v[1])
}
default:
return errors.New("wrong argument to \"config debug-info-directories\"")
}
if t.client != nil {
t.client.SetDebugInfoDirectories(t.conf.DebugInfoDirectories)
}
return nil
}
View on GitHub (pinned to a23773e6c3)
Solutions
- Use the exact flags: `-clear`, `-add <dir>`, or `-rm <dir>`, each with a single leading dash.
- Fix case sensitivity: `-add` not `-Add`.
- To view directories, run `config debug-info-directories` with no arguments rather than guessing a `-list` flag.
Example fix
// before config debug-info-directories --add /usr/local/go/src // after config debug-info-directories -add /usr/local/go/src
Defensive patterns
Strategy: validation
Validate before calling
allowed := map[string]bool{"-clear": true, "-add": true, "-rm": true}
if !allowed[op] {
return fmt.Errorf("unknown op %q; use -clear, -add, or -rm", op)
} Prevention
- Use single-dash flags exactly: -clear, -add, -rm (not --add, not add)
- Remember there is no -list flag; bare command lists directories
- Check case: flags are lowercase
When it happens
Trigger: Running e.g. `config debug-info-directories --add /path` (double dash), `-Add` (wrong case), `add /path` (missing dash), or `-list` (not a supported subcommand).
Common situations: Users assuming GNU-style double-dash flags; expecting a listing/list subcommand; typos like `-ad` or `-remove`.
Related errors
- too many arguments to "config substitute-path"
- not enough arguments to "config debug-info-directories"
- command not available
- you must specify a thread
- too many arguments to goroutine
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/41ecf4fc81db795a.
Report an issue: GitHub.