plandex-ai/plandex · error
failed to get map file info for %s - should already be set
Error message
failed to get map file info for %s - should already be set
What it means
An internal-consistency error: after the existence-check phase, each map file must have cached os.FileInfo ('should already be set'). If the updates phase finds hasFileInfo false, the library raises this error rather than proceeding with a nil FileInfo. It signals a broken assumption between the two concurrent phases, not a disk problem.
Source
Thrown at app/cli/lib/context_update.go:732
var fileInfo os.FileInfo
var hasFileInfo bool
mu.Lock()
if _, ok := mapFileInfoByPath[path]; ok {
fileInfo = mapFileInfoByPath[path]
hasFileInfo = true
} else if _, ok := mapFileRemovedByPath[path]; ok {
removed = true
}
mu.Unlock()
if removed {
innerUpdatesErrCh <- nil
return
}
if !hasFileInfo {
innerUpdatesErrCh <- fmt.Errorf("failed to get map file info for %s - should already be set", path)
return
}
size := fileInfo.Size()
var totalMapSize int64
mu.Lock()
prevTokens := ctx.MapTokens[path]
prevSize := ctx.MapSizes[path]
prevSha := ctx.MapShas[path]
totalMapSize = state.totalMapSize
mu.Unlock()
res, err := getMapFileDetails(path, size, totalMapSize)
if err != nil {
innerUpdatesErrCh <- fmt.Errorf("failed to get map file details for %s: %v", path, err)
return
}
View on GitHub (pinned to e2d772072e)
Solutions
- Simply re-run the context refresh — this is typically transient.
- If reproducible, remove and re-add the map context to rebuild its file list.
- Check for processes deleting/recreating files concurrently during refresh.
- Report as a library bug if it reproduces on a stable filesystem with no concurrent writers.
Defensive patterns
Strategy: retry
Try / catch
if err := refreshMapCtx(ctx); err != nil {
if strings.Contains(err.Error(), "should already be set") {
// transient internal-state race: retry the refresh once
}
} Prevention
- Re-run the refresh when this appears — it is typically transient
- Avoid concurrent deletions of mapped files during refresh
- Rebuild the map context if it recurs on stable storage
- Report persistent occurrences as a library bug
When it happens
Trigger: In the updates goroutine for a map file, hasFileInfo is false — i.e. the existence phase neither produced a FileInfo nor removed the file, so the fileInfo variable was never populated when the updates phase ran.
Common situations: Race where the file is deleted after the existence check but before the updates phase reads it, combined with a timing window that skips the removal path; a bug or interrupted earlier phase; unusual filesystems whose Stat succeeds once then fails on re-check.
Related errors
- failed to get file info for %s: %v
- failed to read file %s: %v
- failed to load context: %v
- failed to get file map: %v
- failed to delete contexts: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/6aece544300639b0.
Report an issue: GitHub.