{"record":{"id":"d53ade6ea3aa2435","repo":"plandex-ai/plandex","slug":"error-storing-context-v","errorCode":null,"errorMessage":"error storing context: %v","messagePattern":"error storing context: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/db/context_helpers_update.go","lineNumber":340,"sourceCode":"\t\t\t\t} else {\n\t\t\t\t\ttotalPlannerTokens += tokenDiff\n\t\t\t\t}\n\t\t\t\tmu.Unlock()\n\n\t\t\t\tcontext.NumTokens = newNumTokens\n\t\t\t} else {\n\t\t\t\tcontext.Body = params.Body\n\t\t\t\thash := sha256.Sum256([]byte(context.Body))\n\t\t\t\tcontext.Sha = hex.EncodeToString(hash[:])\n\t\t\t}\n\n\t\t\t// log.Println(\"storing context\", id)\n\t\t\t// log.Printf(\"context name: %s, sha: %s\\n\", context.Name, context.Sha)\n\n\t\t\terr := StoreContext(context, false)\n\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error storing context: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// log.Println(\"stored context\", id)\n\t\t\t// log.Println()\n\n\t\t\terrCh <- nil\n\t\t}(id, params)\n\t}\n\n\tfor i := 0; i < len(*req); i++ {\n\t\terr := <-errCh\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error storing context: %v\", err)\n\t\t}\n\t}\n\n\tif planConfig.AutoLoadContext {","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/db/context_helpers_update.go#L322-L358","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the inner %v error and server logs for the specific StoreContext failure","Verify disk space, write permissions, and health of the plan data directory","Look for git lock files (.git/index.lock) or conflicted state in the plan repo and clean them","Retry the update once storage is healthy; a single failed context aborts the whole batch"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := checkStorageHealth(); err != nil {\n    return fmt.Errorf(\"storage unavailable, skipping update: %w\", err)\n} // check disk space and writability of the data dir before updating","typeGuard":null,"tryCatchPattern":"err := StoreContext(context, false)\nif err != nil {\n    if isTransient(err) { // EINTR, temporary fs errors\n        time.Sleep(time.Second)\n        err = StoreContext(context, false)\n    }\n    return fmt.Errorf(\"error storing context: %v\", err)\n}","preventionTips":["Monitor disk space and inode usage on the server data volume","Ensure the process user owns the plan context directories","Clean stale git lock files after crashes","Alert on StoreContext failures before they block batch updates"],"tags":["storage","filesystem","git","go"],"backgroundTag":"context-store-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"}