BerriAI/litellm · error · HTTPException

Failed to append message

Error message

Failed to append message

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.

Source

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

            return msg

        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 message: %s", e)
            raise HTTPException(status_code=500, detail=str(e))

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


@router.get(
    "/v1/workflows/runs/{run_id}/messages",
    tags=["workflow management"],
    dependencies=[Depends(user_api_key_auth)],
)
async def list_workflow_messages(
    run_id: str,
    limit: int = Query(100, ge=1, le=500),
    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
    """Fetch conversation history 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)

Solutions

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

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/workflow_management_endpoints.py:500 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/b7265380c3a58be6. Report an issue: GitHub.