{"record":{"id":"552ad04662d22af1","repo":"plandex-ai/plandex","slug":"error-invalidating-conflicted-results-v","errorCode":null,"errorMessage":"error invalidating conflicted results: %v","messagePattern":"error invalidating conflicted results: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/db/context_helpers_update.go","lineNumber":244,"sourceCode":"\t\t\t\tMaxTokensExceeded: true,\n\t\t\t}, nil\n\t\t}\n\t}\n\tfilesToLoad := map[string]string{}\n\tfor _, context := range updatedContexts {\n\t\tif context.ContextType == shared.ContextFileType {\n\t\t\tfilesToLoad[context.FilePath] = (*req)[context.Id].Body\n\t\t}\n\t}\n\n\tif !params.SkipConflictInvalidation {\n\t\terr = invalidateConflictedResults(invalidateConflictedResultsParams{\n\t\t\torgId:         orgId,\n\t\t\tplanId:        planId,\n\t\t\tfilesToUpdate: filesToLoad,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error invalidating conflicted results: %v\", err)\n\t\t}\n\t}\n\n\terrCh = make(chan error, len(*req))\n\n\tfor id, params := range *req {\n\t\tgo func(id string, params *shared.UpdateContextParams) {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tlog.Printf(\"panic in UpdateContexts: %v\\n%s\", r, debug.Stack())\n\t\t\t\t\terrCh <- fmt.Errorf(\"panic in UpdateContexts: %v\\n%s\", r, debug.Stack())\n\t\t\t\t\truntime.Goexit() // don't allow outer function to continue and double-send to channel\n\t\t\t\t}\n\t\t\t}()\n\t\t\tcontext := contextsById[id]\n\n\t\t\tif context.ContextType == shared.ContextMapType {\n\t\t\t\toldNumTokens := context.NumTokens","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/db/context_helpers_update.go#L226-L262","documentation":"Before applying updates, UpdateContexts calls invalidateConflictedResults, which marks prior convo-message build results that conflict with the files being updated as invalidated. This wrapper means that invalidation flow failed — usually a database error fetching or updating ConvoMessageDescriptions, or a git operation inside that path failing.","triggerScenarios":"UpdateContexts with filesToUpdate non-empty when GetConvoMessageDescriptions or a subsequent DB/git write inside invalidateConflictedResults returns an error (DB unreachable, transaction conflict, missing plan, git repo state issues).","commonSituations":"Postgres is down or connection pool exhausted; plan was deleted concurrently; conflicting concurrent updates from multiple clients cause git-level conflicts during invalidation.","solutions":["Check the inner %v error and database connectivity (Conn health, pool exhaustion)","Retry the UpdateContexts call once the database is reachable","Verify the plan/org still exists and no concurrent process deleted its rows","Inspect app/server/db/context_helpers_conflicts.go to see which step (descriptions fetch vs invalidation write) failed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := invalidateConflictedResults(params)\nif err != nil {\n    if isTransientDBError(err) {\n        time.Sleep(backoff)\n        err = invalidateConflictedResults(params)\n    }\n    return fmt.Errorf(\"error invalidating conflicted results: %v\", err)\n}","preventionTips":["Monitor database health before issuing bulk context updates","Avoid concurrent deletion of plans during updates","Keep migrations in sync so ConvoMessageDescriptions schema is current","Retry transient DB errors with exponential backoff"],"tags":["database","git","conflict","go"],"backgroundTag":"database-operation-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"}