BerriAI/litellm · error · HTTPException

Failed to append event

Error message

Failed to append event

What it means

HTTPException raised when appending a workflow message fails for a reason other than the retryable sequence collision — the caught database exception is reported with this generic detail. It indicates the message insert could not be completed for the given run.

Solutions

  1. Check proxy logs for the storage failure, then retry appending the event.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/workflow_management_endpoints.py:416 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/570c427d896e07cf. Report an issue: GitHub.

Appendix: source

Thrown at litellm/proxy/management_endpoints/workflow_management_endpoints.py:416

            return event

        except Exception as e:
            if UniqueViolationError is not None and isinstance(e, UniqueViolationError):
                if attempt == _MAX_SEQUENCE_RETRIES - 1:
                    verbose_proxy_logger.exception(
                        "Sequence number collision after %d retries for run %s",
                        _MAX_SEQUENCE_RETRIES,
                        run_id,
                    )
                    raise HTTPException(
                        status_code=409,
                        detail="Concurrent write conflict — please retry",
                    )
                continue
            verbose_proxy_logger.exception("Error appending workflow event: %s", e)
            raise HTTPException(status_code=500, detail=str(e))

    raise HTTPException(status_code=500, detail="Failed to append event")  # pragma: no cover


@router.get(
    "/v1/workflows/runs/{run_id}/events",
    tags=["workflow management"],
    dependencies=[Depends(user_api_key_auth)],
)
async def list_workflow_events(
    run_id: str,
    limit: int = Query(100, ge=1, le=500),
    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
    """Fetch event log for a run, ordered by sequence_number. Default limit 100, max 500."""
    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(status_code=500, detail=CommonProxyErrors.db_not_connected_error.value)

View on GitHub (pinned to 77b7c6c40c)