{"record":{"id":"0190ecf2877c12a8","repo":"plandex-ai/plandex","slug":"failed-to-check-context-conflicts-v-0190ec","errorCode":null,"errorMessage":"failed to check context conflicts: %v","messagePattern":"failed to check context conflicts: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_update.go","lineNumber":262,"sourceCode":"\t}\n\n\tfilesToLoad := map[string]string{}\n\tfor id := range req {\n\t\tcontext := contextsById[id]\n\t\tif context.ContextType == shared.ContextFileType {\n\t\t\tfilesToLoad[context.FilePath] = context.Body\n\t\t}\n\t}\n\tfor id := range deleteIds {\n\t\tcontext := contextsById[id]\n\t\tif context.ContextType == shared.ContextFileType {\n\t\t\tfilesToLoad[context.FilePath] = \"\"\n\t\t}\n\t}\n\n\thasConflicts, err = checkContextConflicts(filesToLoad)\n\tif err != nil {\n\t\treturn UpdateContextResult{}, fmt.Errorf(\"failed to check context conflicts: %v\", err)\n\t}\n\n\tif len(req) > 0 {\n\t\tres, apiErr := api.Client.UpdateContext(CurrentPlanId, CurrentBranch, req)\n\t\tif apiErr != nil {\n\t\t\treturn UpdateContextResult{}, fmt.Errorf(\"failed to update context: %v\", apiErr)\n\t\t}\n\t\tmsg = res.Msg\n\t}\n\n\tif len(deleteIds) > 0 {\n\t\tres, apiErr := api.Client.DeleteContext(CurrentPlanId, CurrentBranch, shared.DeleteContextRequest{\n\t\t\tIds: deleteIds,\n\t\t})\n\t\tif apiErr != nil {\n\t\t\treturn UpdateContextResult{}, fmt.Errorf(\"failed to delete contexts: %v\", apiErr)\n\t\t}\n\t\tmsg += \" \" + res.Msg","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_update.go#L244-L280","documentation":"Before applying an update, UpdateContext calls checkContextConflicts on all file-type contexts being updated or deleted to detect pending local changes that would conflict. If that internal check itself errors (not merely reports conflicts), the update aborts with this wrapper.","triggerScenarios":"checkContextConflicts fails while reading/hash-checking filesToLoad — typically filesystem errors on context file paths (unreadable, removed mid-check), or an internal error in the diff/sha computation.","commonSituations":"Race: a file deleted between listing and conflict check; permission-restricted files; very large files causing read errors; a bug in the conflict checker on unusual file content.","solutions":["Check the wrapped error for the failing path and fix its readability/existence","Remove and re-add the problematic context entry (plandex context rm / plandex load)","Re-run the command; transient races usually clear on retry","If it persists on a specific file, report a bug with the file type and error"],"exampleFix":"// before: failing whole update on one unreadable file\nhasConflicts, err := lib.UpdateContext(params)\n// after: pre-validate files to load and drop broken ones\nfor _, c := range contexts {\n    if c.ContextType == shared.ContextFileType {\n        if _, err := os.Stat(c.FilePath); err != nil {\n            fmt.Printf(\"removing missing context %s (%s)\\n\", c.Id, c.FilePath)\n        }\n    }\n}\nhasConflicts, err := lib.UpdateContext(params)","handlingStrategy":"validation","validationCode":"for _, c := range contexts {\n    if c.ContextType == shared.ContextFileType {\n        if fi, err := os.Stat(c.FilePath); err != nil || fi.IsDir() {\n            return fmt.Errorf(\"context file %s not a readable file\", c.FilePath)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"res, err := lib.UpdateContext(params)\nif err != nil && strings.Contains(err.Error(), \"failed to check context conflicts\") {\n    return fmt.Errorf(\"conflict check failed; fix file access and retry: %w\", err)\n}","preventionTips":["Don't mutate context files while an update runs","Remove context entries before deleting files locally","Run as a user with read access to all context files","Retry once on transient filesystem races"],"tags":["go","filesystem","conflict-detection","context"],"backgroundTag":"conflict-check-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}