{"record":{"id":"ed9c74a0667dd0f0","repo":"mlflow/mlflow","slug":"unknown-status-request-status","errorCode":null,"errorMessage":"Unknown status: {request.status}","messagePattern":"Unknown status: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"info","filePath":"mlflow/server/assistant/api.py","lineNumber":512,"sourceCode":"        SessionPatchResponse indicating success\n    \"\"\"\n    session = SessionManager.load(session_id)\n    if session is None:\n        raise HTTPException(status_code=404, detail=\"Session not found\")\n\n    if request.status == \"cancelled\":\n        # Terminate any associated subprocess. The OpenAI-compatible provider\n        # holds no in-process state to release (the turn ends at each prompt).\n        # Drop any tool permissions/results so later stream doesn't see stale state.\n        session.pending_tool_decisions = {}\n        session.pending_client_tool_results = {}\n        SessionManager.save(session_id, session)\n        terminated = terminate_session_process(session_id)\n        msg = \"Session cancelled and process terminated\" if terminated else \"Session cancelled\"\n        return SessionPatchResponse(message=msg)\n\n    # This branch is unreachable due to Literal type, but satisfies type checker\n    raise HTTPException(status_code=400, detail=f\"Unknown status: {request.status}\")\n\n\n@assistant_router.post(\"/sessions/{session_id}/permission\")\n@_remote_access_policy(_RemoteAccessPolicy.ONLY_SAFE_PROVIDER)\nasync def resolve_permission(session_id: str, request: PermissionDecision) -> MessageResponse:\n    \"\"\"Deliver a tool-call permission decision and resume the paused turn on a new stream.\n\n    The decision is stored on the session and consumed by the next stream, which\n    re-enters the provider with the choice in context. Stateless across requests:\n    any worker can serve the decision because the pending state lives in the\n    session, not process memory.\n    \"\"\"\n    try:\n        SessionManager.validate_session_id(session_id)\n    except ValueError as e:\n        raise HTTPException(status_code=400, detail=str(e))\n\n    session = SessionManager.load(session_id)","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/server/assistant/api.py#L494-L530","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nfetch(url, {method: 'PATCH', body: JSON.stringify({status: 'stop'})});\n// after\nfetch(url, {method: 'PATCH', body: JSON.stringify({status: 'cancelled'})});","handlingStrategy":"validation","validationCode":"const ALLOWED_STATUSES = ['cancelled'];\nif (!ALLOWED_STATUSES.includes(body.status)) throw new Error(`status must be one of ${ALLOWED_STATUSES}`);","typeGuard":"function isValidStatus(s) { return s === 'cancelled'; }","tryCatchPattern":"const res = await patchSession(id, {status});\nif (res.status === 400 && /Unknown status/.test(res.detail)) { fix the status string to 'cancelled' }","preventionTips":["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."],"tags":["http-400","api-misuse","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}