plandex-ai/plandex · error

failed to get map file details for %s: %v

Error message

failed to get map file details for %s: %v

What it means

Raised when getMapFileDetails fails while recomputing a map file's SHA and token count. This helper reads/encodes the file content to decide whether the map entry is unchanged, and any read/encode/tokenize failure is wrapped with the file path.

Source

Thrown at app/cli/lib/context_update.go:747

						}

						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
						}

						if res.shaVal == prevSha {
							// no change
							innerUpdatesErrCh <- nil
							return
						}

						mu.Lock()

						totalMapPaths++

						if totalMapPaths > shared.MaxContextMapPaths {
							if _, ok := mapFilesSkippedAfterSizeLimitSet[path]; !ok {
								mapFilesSkippedAfterSizeLimitSet[path] = true
								mapFilesSkippedAfterSizeLimit = append(mapFilesSkippedAfterSizeLimit, path)
							}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the wrapped %v cause; restore read permissions or recreate the missing file.
  2. Re-run the refresh after concurrent modifications settle.
  3. Rebuild the map context if the file set is stale relative to disk.
  4. Check disk health (dmesg/smart) if EIO appears in the wrapped error.
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.ReadFile(path); err != nil {
    return fmt.Errorf("map file %s unreadable before refresh: %w", path, err)
}

Try / catch

if err := refreshMapCtx(ctx); err != nil {
    if strings.Contains(err.Error(), "failed to get map file details") {
        // wrapped cause names the real read/encode failure
    }
}

Prevention

When it happens

Trigger: getMapFileDetails(path, size, totalMapSize) returns err during the map updates phase — typically because the file could not be read (permissions, deleted since stat, I/O error) or its content could not be hashed/tokenized.

Common situations: File deleted between the stat phase and details phase (TOCTOU race); read permission revoked; file locked by another process; disk I/O error on a failing drive.

Related errors


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