plandex-ai/plandex · error

error storing context: %v

Error message

error storing context: %v

What it means

After mutating the context in memory, the worker goroutine calls StoreContext(context, false) to persist it (create context dir, write context files, update caches/git). If StoreContext fails, the worker wraps and forwards the error. Typical inner causes are filesystem errors (mkdir/write failures, disk full, permissions) or errors in the map-cache/git steps inside StoreContext.

Source

Thrown at app/server/db/context_helpers_update.go:340

				} else {
					totalPlannerTokens += tokenDiff
				}
				mu.Unlock()

				context.NumTokens = newNumTokens
			} else {
				context.Body = params.Body
				hash := sha256.Sum256([]byte(context.Body))
				context.Sha = hex.EncodeToString(hash[:])
			}

			// log.Println("storing context", id)
			// log.Printf("context name: %s, sha: %s\n", context.Name, context.Sha)

			err := StoreContext(context, false)

			if err != nil {
				errCh <- fmt.Errorf("error storing context: %v", err)
				return
			}

			// log.Println("stored context", id)
			// log.Println()

			errCh <- nil
		}(id, params)
	}

	for i := 0; i < len(*req); i++ {
		err := <-errCh
		if err != nil {
			return nil, fmt.Errorf("error storing context: %v", err)
		}
	}

	if planConfig.AutoLoadContext {

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check the inner %v error and server logs for the specific StoreContext failure
  2. Verify disk space, write permissions, and health of the plan data directory
  3. Look for git lock files (.git/index.lock) or conflicted state in the plan repo and clean them
  4. Retry the update once storage is healthy; a single failed context aborts the whole batch
Defensive patterns

Strategy: try-catch

Validate before calling

if err := checkStorageHealth(); err != nil {
    return fmt.Errorf("storage unavailable, skipping update: %w", err)
} // check disk space and writability of the data dir before updating

Try / catch

err := StoreContext(context, false)
if err != nil {
    if isTransient(err) { // EINTR, temporary fs errors
        time.Sleep(time.Second)
        err = StoreContext(context, false)
    }
    return fmt.Errorf("error storing context: %v", err)
}

Prevention

When it happens

Trigger: StoreContext fails for one context during UpdateContexts — e.g. os.MkdirAll fails on the plan context dir, write to disk fails, or a git operation inside StoreContext errors.

Common situations: Disk full or read-only filesystem on the server; permission problems on the data directory; concurrent writes corrupting state; git repo in a conflicted/locked state.

Related errors


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