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

  1. Simply re-run the context refresh — this is typically transient.
  2. If reproducible, remove and re-add the map context to rebuild its file list.
  3. Check for processes deleting/recreating files concurrently during refresh.
  4. 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

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


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/6aece544300639b0. Report an issue: GitHub.