{"record":{"id":"c9ae7c9835eb9eae","repo":"BerriAI/litellm","slug":"concurrent-write-conflict-please-retry","errorCode":null,"errorMessage":"Concurrent write conflict — please retry","messagePattern":"Concurrent write conflict — please retry","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"litellm/proxy/management_endpoints/workflow_management_endpoints.py","lineNumber":408,"sourceCode":"            async with prisma_client.db.tx() as tx:\n                event: object = await tx.litellm_workflowevent.create(data=event_data)\n                if new_status:\n                    await tx.litellm_workflowrun.update(\n                        where={\"run_id\": run_id},\n                        data={\"status\": new_status},\n                    )\n\n            return event\n\n        except Exception as e:\n            if UniqueViolationError is not None and isinstance(e, UniqueViolationError):\n                if attempt == _MAX_SEQUENCE_RETRIES - 1:\n                    verbose_proxy_logger.exception(\n                        \"Sequence number collision after %d retries for run %s\",\n                        _MAX_SEQUENCE_RETRIES,\n                        run_id,\n                    )\n                    raise HTTPException(\n                        status_code=409,\n                        detail=\"Concurrent write conflict — please retry\",\n                    )\n                continue\n            verbose_proxy_logger.exception(\"Error appending workflow event: %s\", e)\n            raise HTTPException(status_code=500, detail=str(e))\n\n    raise HTTPException(status_code=500, detail=\"Failed to append event\")  # pragma: no cover\n\n\n@router.get(\n    \"/v1/workflows/runs/{run_id}/events\",\n    tags=[\"workflow management\"],\n    dependencies=[Depends(user_api_key_auth)],\n)\nasync def list_workflow_events(\n    run_id: str,\n    limit: int = Query(100, ge=1, le=500),","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/workflow_management_endpoints.py#L390-L426","documentation":"HTTPException(409) raised after a sequence-number UniqueViolationError persisted through all retry attempts while appending a workflow event inside the transaction: concurrent writers kept claiming the same next sequence_number. It signals a lost race — the client should retry the append.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/workflow_management_endpoints.py:408 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; the conflict is transient."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}