{"record":{"id":"6e3cc89e71f55b6a","repo":"plandex-ai/plandex","slug":"failed-to-get-file-info-for-s-v-6e3cc8","errorCode":null,"errorMessage":"failed to get file info for %s: %v","messagePattern":"failed to get file info for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_update.go","lineNumber":397,"sourceCode":"\t\t\t\t\tnumFilesRemoved++\n\t\t\t\t\ttokenDiffsById[ctx.Id] = -ctx.NumTokens\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tfileContent, err := os.ReadFile(ctx.FilePath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tmu.Lock()\n\t\t\t\t\tdefer mu.Unlock()\n\t\t\t\t\terrs = append(errs, fmt.Errorf(\"failed to read the file %s: %v\", ctx.FilePath, err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfileContent = shared.NormalizeEOL(fileContent)\n\n\t\t\t\tfileInfo, err := os.Stat(ctx.FilePath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tmu.Lock()\n\t\t\t\t\tdefer mu.Unlock()\n\t\t\t\t\terrs = append(errs, fmt.Errorf(\"failed to get file info for %s: %v\", ctx.FilePath, err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tsize := fileInfo.Size()\n\n\t\t\t\t// Individual skip checks\n\t\t\t\tif size > shared.MaxContextBodySize {\n\t\t\t\t\tmu.Lock()\n\t\t\t\t\tdefer mu.Unlock()\n\n\t\t\t\t\tfilesSkippedTooLarge = append(filesSkippedTooLarge, filePathWithSize{Path: ctx.FilePath, Size: size})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif totalSize+size > shared.MaxContextBodySize {\n\t\t\t\t\tmu.Lock()\n\t\t\t\t\tdefer mu.Unlock()\n\n\t\t\t\t\tfilesSkippedAfterSizeLimit = append(filesSkippedAfterSizeLimit, ctx.FilePath)\n\t\t\t\t\treturn","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_update.go#L379-L415","documentation":"This error is produced when os.Stat fails on a file already registered as a file-type context during a context refresh. The file passed the initial IsNotExist check and ReadFile, but stat immediately afterward failed, so the library cannot determine its size for the MaxContextBodySize skip checks. It wraps the underlying os error (permission, race deletion, etc.) with the file path.","triggerScenarios":"os.Stat(ctx.FilePath) returns a non-IsNotExist error inside the per-file goroutine of checkOutdatedAndMaybeUpdateContext, typically after the file was read successfully but then vanished or permissions changed mid-scan.","commonSituations":"File deleted between the IsNotExist pre-check/ReadFile and the Stat call by another process (build tooling, git operations); permission bits changed on the file or parent directory; file on a flaky/network mount; running as a user without read access after an ACL change.","solutions":["Check the wrapped %v cause: if it is a permission error, fix chmod/chown or run with sufficient privileges.","Re-run the command if the file was being deleted concurrently; ensure no build/watch process is mutating files during the scan.","If the file is genuinely gone, remove it from the context (add via the context add command again or restart) so the deleteIds path handles it instead.","For network mounts, verify mount health and retry."],"exampleFix":"// before\ncat missing-or-locked.txt > /dev/null  # permission denied\n# after\nchmod u+r app/config.yaml  # or fix ownership before refreshing context","handlingStrategy":"retry","validationCode":"if _, err := os.Stat(path); err != nil { return fmt.Errorf(\"context file %s not statable before refresh: %w\", path, err) }","typeGuard":null,"tryCatchPattern":"if err := refreshContext(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to get file info\") {\n        // log wrapped cause, retry once after settling concurrent writers\n    }\n}","preventionTips":["Ensure no build/watch tools mutate files during context refresh","Run the CLI with read access to all context files","Keep context files on local, stable filesystems","Prune stale contexts regularly so files race less often"],"tags":["filesystem","stat","concurrency"],"backgroundTag":"file-stat-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}