{"record":{"id":"50bac5744331e72e","repo":"go-delve/delve","slug":"too-many-arguments-to-config-substitute-path","errorCode":null,"errorMessage":"too many arguments to \"config substitute-path\"","messagePattern":"too many arguments to \"config substitute-path\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/config.go","lineNumber":121,"sourceCode":"\tcase 1: // delete substitute-path rule\n\t\tfor i := range t.conf.SubstitutePath {\n\t\t\tif t.conf.SubstitutePath[i].From == argv[0] {\n\t\t\t\tcopy(t.conf.SubstitutePath[i:], t.conf.SubstitutePath[i+1:])\n\t\t\t\tt.conf.SubstitutePath = t.conf.SubstitutePath[:len(t.conf.SubstitutePath)-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 t.conf.SubstitutePath {\n\t\t\tif t.conf.SubstitutePath[i].From == argv[0] {\n\t\t\t\tt.conf.SubstitutePath[i].To = argv[1]\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tt.conf.SubstitutePath = append(t.conf.SubstitutePath, config.SubstitutePathRule{From: argv[0], To: argv[1]})\n\tdefault:\n\t\treturn errors.New(\"too many arguments to \\\"config substitute-path\\\"\")\n\t}\n\treturn nil\n}\n\nfunc configureSetAlias(t *Term, rest string) error {\n\targv := config.SplitQuotedFields(rest, '\"')\n\tswitch len(argv) {\n\tcase 1: // delete alias rule\n\t\tfor k := range t.conf.Aliases {\n\t\t\tv := t.conf.Aliases[k]\n\t\t\tfor i := range v {\n\t\t\t\tif v[i] == argv[0] {\n\t\t\t\t\tcopy(v[i:], v[i+1:])\n\t\t\t\t\tt.conf.Aliases[k] = v[:len(v)-1]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase 2: // add alias rule","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/config.go#L103-L139","documentation":"This error is thrown by Delve's terminal configuration handler when the `config substitute-path` command is given more than two whitespace-separated arguments. The command only supports: no arguments (list rules), one argument (delete the rule whose From matches), or two arguments (add/update a From→To mapping). Anything else falls into the `default` branch of the length switch in configureSetSubstitutePath.","triggerScenarios":"Running `config substitute-path A B C` (three or more arguments) in the Delve CLI, e.g. trying to add multiple mappings in a single command or accidentally leaving an extra token such as a trailing quoted path or a stray character in the rest string.","commonSituations":"Users paste multi-rule mappings from docs or scripts as one command; shell-style multi-assignment habits (`from to from2 to2`) carried over from other tools; quoting mistakes in paths with spaces causing SplitQuotedFields to produce extra tokens.","solutions":["Split multiple mappings into separate commands: `config substitute-path /from /to` then `config substitute-path /from2 /to2`.","Quote paths containing spaces: `config substitute-path \"/my from\" \"/my to\"` so SplitQuotedFields counts exactly two tokens.","Run `config substitute-path` with no arguments to list current rules and confirm syntax before modifying."],"exampleFix":"// before\ndlv: config substitute-path /old/path /new/path /old/path2 /new/path2\n// after\ndlv: config substitute-path /old/path /new/path\ndlv: config substitute-path /old/path2 /new/path2","handlingStrategy":"validation","validationCode":"parts := config.SplitQuotedFields(rest, '\"')\nif len(parts) > 2 {\n    return fmt.Errorf(\"substitute-path takes at most 2 args, got %d\", len(parts))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote paths containing spaces so tokenization yields exactly two fields","Run `config substitute-path` with no args first to inspect existing rules","Issue one command per From/To mapping"],"tags":["cli","configuration","argument-count"],"backgroundTag":"wrong-number-of-arguments","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}