{"record":{"id":"37eca214611cc8c6","repo":"go-delve/delve","slug":"too-many-arguments-to-config-substitutepath","errorCode":null,"errorMessage":"too many arguments to \"config substitutePath\"","messagePattern":"too many arguments to \"config substitutePath\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/dap/config.go","lineNumber":94,"sourceCode":"\t\t\t\tcopy(args.substitutePathServerToClient[i:], args.substitutePathServerToClient[i+1:])\n\t\t\t\targs.substitutePathServerToClient = args.substitutePathServerToClient[:len(args.substitutePathServerToClient)-1]\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"could not find rule for %q\", argv[0])\n\tcase 2: // add substitute-path rule\n\t\tfor i := range args.substitutePathClientToServer {\n\t\t\tif args.substitutePathClientToServer[i][0] == argv[0] {\n\t\t\t\targs.substitutePathClientToServer[i][1] = argv[1]\n\t\t\t\targs.substitutePathServerToClient[i][0] = argv[1]\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\targs.substitutePathClientToServer = append(args.substitutePathClientToServer, [2]string{argv[0], argv[1]})\n\t\targs.substitutePathServerToClient = append(args.substitutePathServerToClient, [2]string{argv[1], argv[0]})\n\n\tdefault:\n\t\treturn errors.New(\"too many arguments to \\\"config substitutePath\\\"\")\n\t}\n\treturn nil\n}\n\nfunc configureSetShowPprofLabels(args *launchAttachArgs, rest string) error {\n\tif strings.TrimSpace(rest) == \"-clear\" {\n\t\targs.ShowPprofLabels = args.ShowPprofLabels[:0]\n\t\treturn nil\n\t}\n\tdelete := false\n\targv := config.SplitQuotedFields(rest, '\"')\n\tif len(argv) == 2 && argv[0] == \"-clear\" {\n\t\targv = argv[1:]\n\t\tdelete = true\n\t}\n\tswitch len(argv) {\n\tcase 0:\n\t\t// do nothing, let caller show the current list of labels","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/dap/config.go#L76-L112","documentation":"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.","triggerScenarios":"`config substitutePath=<a> <b> <c>` — three or more space-separated tokens; also paths containing unquoted spaces that split into extra argv entries.","commonSituations":"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.","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"],"exampleFix":"// before\nconfig substitutePath=/home/me/My Project /srv/app\n// after\nconfig substitutePath=\"/home/me/My Project\" /srv/app","handlingStrategy":"validation","validationCode":"argv := strings.Fields(rest)\nif len(argv) > 2 && !strings.HasPrefix(rest, \"-clear\") {\n\t// quote paths with spaces or split into multiple commands\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote paths containing spaces","One mapping per command","Normalize paths before sending to avoid space-splitting"],"tags":["dap","config","substitute-path"],"backgroundTag":"too-many-arguments","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}