{"record":{"id":"5bfb1a3db0aedc1f","repo":"go-delve/delve","slug":"could-not-find-rule-for-q","errorCode":null,"errorMessage":"could not find rule for %q","messagePattern":"could not find rule for %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/config.go","lineNumber":111,"sourceCode":"\t\targv = argv[1:]\n\t}\n\tswitch len(argv) {\n\tcase 0:\n\t\tw := new(tabwriter.Writer)\n\t\tw.Init(t.stdout, 0, 8, 1, ' ', 0)\n\t\tfor i := range t.conf.SubstitutePath {\n\t\t\tfmt.Fprintf(w, \"%q\\t→\\t%q\\n\", t.conf.SubstitutePath[i].From, t.conf.SubstitutePath[i].To)\n\t\t}\n\t\tw.Flush()\n\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","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/config.go#L93-L129","documentation":"Returned by the `config substitute-path <from>` command (configureSetSubstitutePath) when removing or the rule lookup fails: no entry in t.conf.SubstitutePath has a From field equal to argv[0]. Delve keeps substitute-path rules as an ordered list of {From,To} pairs and only rewrites paths whose prefix exactly matches a stored From.","triggerScenarios":"Running `config substitute-path /old/path` with 1 argument (delete) or `config substitute-path /old/path /new/path` with 2 arguments (add/update) when no rule whose From equals /old/path exists; also misspelling the From path or using a non-normalized path (trailing slash, relative vs absolute).","commonSituations":"User tries to delete a rule that was already removed, mistypes the source path, or assumes prefix/partial matching works when only exact string equality against the From field is checked.","solutions":["Run `config substitute-path` with no arguments to list existing rules and copy the From value exactly","Delete the rule with the exact stored From string (watch trailing slashes and absolute vs relative forms)","If you meant to add a brand-new mapping, verify the argument count: two args add/update, one arg deletes","Update to a version that normalizes paths if your workflow relies on path normalization"],"exampleFix":"// before\ndlv> config substitute-path /home/me/oldproject /home/me/newproject   # fails: rule never existed\n// after\ndlv> config substitute-path            # list rules first\ndlv> config substitute-path /home/me/oldproject       # exact From match deletes it","handlingStrategy":"validation","validationCode":"rules = t.conf.SubstitutePath\nif not any(r[\"From\"] == argv[0] for r in rules):\n    raise ValueError(\"no substitute-path rule with From=%r; run 'config substitute-path' to list\" % argv[0])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["List existing rules with `config substitute-path` before add/remove","Copy the From string exactly (slashes, trailing separators)","Remember: 1 argument removes, 2 arguments add/update"],"tags":["delve","terminal","configuration","substitute-path"],"backgroundTag":"config-entry-not-found","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}