{"record":{"id":"64bd327e1876c967","repo":"plandex-ai/plandex","slug":"failed-to-check-outdated-context-s","errorCode":null,"errorMessage":"failed to check outdated context: %s","messagePattern":"failed to check outdated context: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_update.go","lineNumber":45,"sourceCode":"\t}\n\n\tvar contexts []*shared.Context\n\n\tif maybeContexts != nil {\n\t\tcontexts = maybeContexts\n\t} else {\n\t\tres, err := api.Client.ListContext(CurrentPlanId, CurrentBranch)\n\t\tif err != nil {\n\t\t\tterm.StopSpinner()\n\t\t\treturn false, false, fmt.Errorf(\"failed to list context: %s\", err)\n\t\t}\n\t\tcontexts = res\n\t}\n\n\toutdatedRes, err := CheckOutdatedContext(contexts, projectPaths)\n\tif err != nil {\n\t\tterm.StopSpinner()\n\t\treturn false, false, fmt.Errorf(\"failed to check outdated context: %s\", err)\n\t}\n\n\tif !quiet {\n\t\tterm.StopSpinner()\n\t}\n\n\tif len(outdatedRes.UpdatedContexts) == 0 && len(outdatedRes.RemovedContexts) == 0 {\n\t\tif !quiet {\n\t\t\tfmt.Println(\"✅ Context is up to date\")\n\t\t}\n\t\treturn false, false, nil\n\t}\n\tif len(outdatedRes.UpdatedContexts) > 0 {\n\t\ttypes := []string{}\n\t\tif outdatedRes.NumFiles > 0 {\n\t\t\tlbl := \"file\"\n\t\t\tif outdatedRes.NumFiles > 1 {\n\t\t\t\tlbl = \"files\"","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_update.go#L27-L63","documentation":"CheckOutdatedContextWithOutput wraps any failure from CheckOutdatedContext (which hashes local files/urls/trees/maps against stored context state) with this generic prefix. It means the staleness check itself could not complete, so the CLI cannot tell whether plan context is current. The inner error (%s) names the actual cause, e.g. unreadable file or stat failure.","triggerScenarios":"Calling CheckOutdatedContextWithOutput when a context file exists but cannot be read (permission denied, deleted between stat and read, is a directory), or any lower-level failure inside CheckOutdatedContext such as file-info retrieval or map-tree computation errors.","commonSituations":"Files were moved/renamed after being added to context; read permissions changed (chmod, different user/CI environment); symlinks pointing to missing targets; running in a container where the mounted project path differs.","solutions":["Read the wrapped inner error to find the specific file or operation that failed","Verify the file exists and is readable by the current user (ls -l, cat the file)","Remove stale context entries for files that no longer exist (plandex context rm) and re-add them","Re-run from the project root so relative context file paths resolve correctly"],"exampleFix":"// before: blindly calling and failing on unreadable file\n_, _, err := lib.CheckOutdatedContextWithOutput(false, false, nil, projectPaths)\n// after: filter unreadable files out first\nfor _, c := range contexts {\n    if c.ContextType == shared.ContextFileType {\n        if _, err := os.ReadFile(c.FilePath); err != nil {\n            fmt.Printf(\"skipping unreadable %s: %v\\n\", c.FilePath, err)\n        }\n    }\n}\noutdated, updated, err := lib.CheckOutdatedContextWithOutput(false, false, contexts, projectPaths)","handlingStrategy":"validation","validationCode":"func allContextFilesReadable(contexts []*shared.Context) error {\n    for _, c := range contexts {\n        if c.ContextType == shared.ContextFileType {\n            if _, err := os.ReadFile(c.FilePath); err != nil {\n                return fmt.Errorf(\"context file %s unreadable: %w\", c.FilePath, err)\n            }\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"outdated, updated, err := lib.CheckOutdatedContextWithOutput(false, false, nil, paths)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to check outdated context\") {\n        // inspect inner cause; refresh context list or fix file access\n        return fmt.Errorf(\"stale-context check failed: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate file readability before adding/refreshing context","Re-run from the project root so relative paths resolve","Remove context entries for deleted/moved files promptly","Keep plandex-cli and plandex-shared versions in sync"],"tags":["go","filesystem","context","cli"],"backgroundTag":"file-read-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}