{"record":{"id":"1b7564a5f4f0e0d8","repo":"plandex-ai/plandex","slug":"error-checking-if-s-is-a-subpath-of-s-s","errorCode":null,"errorMessage":"error checking if %s is a subpath of %s: %s","messagePattern":"error checking if (.+?) is a subpath of (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/fs/paths.go","lineNumber":457,"sourceCode":"\t\treturn false, nil\n\t}\n\n\t// If we want \"absChild == absParent\" to count as inside,\n\t// then !HasPrefix(rel, \"..\") is enough.\n\t// This means child == parent or child is deeper within parent.\n\treturn true, nil\n}\n\nfunc IsIgnored(paths *types.ProjectPaths, path, baseDir string) (bool, string, error) {\n\tif !paths.AllPaths[path] {\n\t\t// if the path isn't in AllPaths, it either:\n\t\t// 1. doesn't exist (in which case we shouldn't be calling this function)\n\t\t// 2. is a subpath of a git ignored dir\n\n\t\tfor dir := range paths.GitIgnoredDirs {\n\t\t\tsubpath, err := IsSubpathOf(dir, path, baseDir)\n\t\t\tif err != nil {\n\t\t\t\treturn false, \"\", fmt.Errorf(\"error checking if %s is a subpath of %s: %s\", path, dir, err)\n\t\t\t}\n\t\t\tif subpath {\n\t\t\t\treturn true, \"git\", nil\n\t\t\t}\n\t\t}\n\t\treturn false, \"\", fmt.Errorf(\"path %s is not in the project\", path)\n\t}\n\n\tif paths.ActivePaths[path] {\n\t\treturn false, \"\", nil\n\t}\n\n\tif paths.PlandexIgnored != nil && paths.PlandexIgnored.MatchesPath(path) {\n\t\treturn true, \"plandex\", nil\n\t}\n\n\treturn true, \"git\", nil\n}","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/fs/paths.go#L439-L475","documentation":"IsIgnored checks whether a path outside the active-path map is ignored because it lives under a git-ignored directory. Each such check calls IsSubpathOf; if any of those calls errors, the failure is wrapped with both the file path and the candidate directory.","triggerScenarios":"A path not present in paths.ActivePaths is checked against every dir in paths.GitIgnoredDirs, and IsSubpathOf returns an error (e.g. filepath.Rel failure, different volumes, invalid path) for one of them.","commonSituations":"Loading context for a path containing characters or structure that break path relativization; paths recorded before a drive/volume change; stale GitIgnoredDirs entries pointing at another volume.","solutions":["Verify the path is inside the current project and on the same volume as GitIgnoredDirs entries","Re-run `plandex load`/context load so ActivePaths is rebuilt with the current path","Inspect the wrapped err to find which dir failed relativization","Clean/normalize the path argument before loading it as context"],"exampleFix":"// before\nMustLoadContext([]string{\"D:\\\\outside\\\\file.go\"})\n// after\nMustLoadContext([]string{\"./internal/file.go\"})","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(path); err != nil {\n    return fmt.Errorf(\"path %s inaccessible before ignore check: %w\", path, err)\n}","typeGuard":null,"tryCatchPattern":"ok, reason, err := IsIgnored(path, paths, baseDir)\nif err != nil {\n    if strings.Contains(err.Error(), \"error getting relative path\") {\n        // treat as not ignored, or skip the offending path\n        ok, reason = false, \"\"\n    } else {\n        return err\n    }\n}","preventionTips":["Keep GitIgnoredDirs and the path set on the same volume","Refresh ActivePaths/GitIgnoredDirs before loading context","Normalize all stored paths with filepath.Clean","Don't load context paths from outside the project root"],"tags":["filesystem","paths","ignore-check"],"backgroundTag":"path-resolution-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}