mlflow/mlflow · info · HTTPException
Unknown status: {request.status}
Error message
Unknown status: {request.status} What it means
patch_session accepts a Literal status value; the only supported value is 'cancelled'. If some other status slips through (bypassing pydantic validation, e.g. raw/untyped client or internal call), the endpoint raises HTTPException 400 'Unknown status: {status}'. The code notes this branch is unreachable for validated requests and exists to satisfy the type checker.
Source
Thrown at mlflow/server/assistant/api.py:512
SessionPatchResponse indicating success
"""
session = SessionManager.load(session_id)
if session is None:
raise HTTPException(status_code=404, detail="Session not found")
if request.status == "cancelled":
# Terminate any associated subprocess. The OpenAI-compatible provider
# holds no in-process state to release (the turn ends at each prompt).
# Drop any tool permissions/results so later stream doesn't see stale state.
session.pending_tool_decisions = {}
session.pending_client_tool_results = {}
SessionManager.save(session_id, session)
terminated = terminate_session_process(session_id)
msg = "Session cancelled and process terminated" if terminated else "Session cancelled"
return SessionPatchResponse(message=msg)
# This branch is unreachable due to Literal type, but satisfies type checker
raise HTTPException(status_code=400, detail=f"Unknown status: {request.status}")
@assistant_router.post("/sessions/{session_id}/permission")
@_remote_access_policy(_RemoteAccessPolicy.ONLY_SAFE_PROVIDER)
async def resolve_permission(session_id: str, request: PermissionDecision) -> MessageResponse:
"""Deliver a tool-call permission decision and resume the paused turn on a new stream.
The decision is stored on the session and consumed by the next stream, which
re-enters the provider with the choice in context. Stateless across requests:
any worker can serve the decision because the pending state lives in the
session, not process memory.
"""
try:
SessionManager.validate_session_id(session_id)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
session = SessionManager.load(session_id)View on GitHub (pinned to 6a27f2decc)
Solutions
- Send status "cancelled" — the only supported value.
- Fix typos in the status string in your request body.
- Update the client SDK to match the server's SessionPatchRequest schema.
- If you need other statuses, that feature does not exist; use the cancel path only.
Example fix
// before
fetch(url, {method: 'PATCH', body: JSON.stringify({status: 'stop'})});
// after
fetch(url, {method: 'PATCH', body: JSON.stringify({status: 'cancelled'})}); Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED_STATUSES = ['cancelled'];
if (!ALLOWED_STATUSES.includes(body.status)) throw new Error(`status must be one of ${ALLOWED_STATUSES}`); Type guard
function isValidStatus(s) { return s === 'cancelled'; } Try / catch
const res = await patchSession(id, {status});
if (res.status === 400 && /Unknown status/.test(res.detail)) { fix the status string to 'cancelled' } Prevention
- Use the typed client (pydantic Literal) rather than hand-built JSON bodies.
- Only ever send "cancelled" — no other status exists.
- Validate request bodies against the SessionPatchRequest schema in tests.
When it happens
Trigger: Sending PATCH /sessions/{id} with a body like {"status": "paused"} or {"status": "stop"} — anything other than "cancelled". Normally prevented by pydantic Literal validation, so it surfaces only with invalid payloads that evaded schema validation.
Common situations: Hand-written curl/scripts using guessed status strings; a client written against a newer/older API version where more statuses existed; bypassing the typed client.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Artifact path must include a filename (cannot end with '/').
- Gateway vendor connections require an API key.
- API keys must be stored in LLM Connections through the 'mlfl
- Gateway API keys require a gateway_vendor.
- {str(e)}
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/ed9c74a0667dd0f0.
Report an issue: GitHub.