go-delve/delve · error
too many arguments to "config substitutePath"
Error message
too many arguments to "config substitutePath"
What it means
The DAP `config substitutePath` setting accepts at most a pair `<client path> <server path>` (plus special forms like -clear or a single removal entry). configureSetSubstitutePath returns this error when the argument vector has more tokens than the allowed forms.
Source
Thrown at service/dap/config.go:94
copy(args.substitutePathServerToClient[i:], args.substitutePathServerToClient[i+1:])
args.substitutePathServerToClient = args.substitutePathServerToClient[:len(args.substitutePathServerToClient)-1]
return nil
}
}
return fmt.Errorf("could not find rule for %q", argv[0])
case 2: // add substitute-path rule
for i := range args.substitutePathClientToServer {
if args.substitutePathClientToServer[i][0] == argv[0] {
args.substitutePathClientToServer[i][1] = argv[1]
args.substitutePathServerToClient[i][0] = argv[1]
return nil
}
}
args.substitutePathClientToServer = append(args.substitutePathClientToServer, [2]string{argv[0], argv[1]})
args.substitutePathServerToClient = append(args.substitutePathServerToClient, [2]string{argv[1], argv[0]})
default:
return errors.New("too many arguments to \"config substitutePath\"")
}
return nil
}
func configureSetShowPprofLabels(args *launchAttachArgs, rest string) error {
if strings.TrimSpace(rest) == "-clear" {
args.ShowPprofLabels = args.ShowPprofLabels[:0]
return nil
}
delete := false
argv := config.SplitQuotedFields(rest, '"')
if len(argv) == 2 && argv[0] == "-clear" {
argv = argv[1:]
delete = true
}
switch len(argv) {
case 0:
// do nothing, let caller show the current list of labelsView on GitHub (pinned to a23773e6c3)
Solutions
- Quote paths containing spaces so they parse as one token
- Submit one mapping per command invocation
- Use `config substitutePath -clear` or the removal form instead of listing many pairs at once
Example fix
// before config substitutePath=/home/me/My Project /srv/app // after config substitutePath="/home/me/My Project" /srv/app
Defensive patterns
Strategy: validation
Validate before calling
argv := strings.Fields(rest)
if len(argv) > 2 && !strings.HasPrefix(rest, "-clear") {
// quote paths with spaces or split into multiple commands
} Prevention
- Quote paths containing spaces
- One mapping per command
- Normalize paths before sending to avoid space-splitting
When it happens
Trigger: `config substitutePath=<a> <b> <c>` — three or more space-separated tokens; also paths containing unquoted spaces that split into extra argv entries.
Common situations: Windows or macOS paths with spaces (e.g. `/Users/me/My Projects/...`) submitted unquoted; users pasting multiple mappings on one line; VS Code launch configs with mappings containing spaces flattened into the REPL.
Related errors
- too many arguments to "config showPprofLabels"
- could not find rule for %q
- unknown config parameter
- not documented
- wrong number of arguments to "config"
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/37eca214611cc8c6.
Report an issue: GitHub.