unslothai/unsloth · warning · HTTPException

Training start request is not ready to acknowledge

Error message

Training start request is not ready to acknowledge

What it means

HTTP 409 from POST /training/start-requests/{id}/acknowledge when backend.acknowledge_start_request returns False, meaning the request is not in a state that accepts acknowledgement (not yet ready, already acknowledged, or terminal).

Source

Thrown at studio/backend/routes/training.py:1093

        message = record.message,
        error = record.error,
        error_code = record.error_code,
    )


@router.post("/start-requests/{start_request_id}/acknowledge")
async def acknowledge_training_start_request(
    start_request_id: str = ApiPath(
        ...,
        min_length = 1,
        max_length = 128,
        pattern = TRAINING_REQUEST_ID_PATTERN,
    ),
    current_subject: str = Depends(get_current_subject),
):
    backend = get_training_backend()
    if not backend.acknowledge_start_request(start_request_id):
        raise HTTPException(
            status_code = 409,
            detail = "Training start request is not ready to acknowledge",
        )
    return {"status": "ok"}


@router.post(
    "/start-requests/{start_request_id}/cancel",
    response_model = TrainingStartRequestStatus,
)
async def cancel_training_start_request(
    start_request_id: str = ApiPath(
        ...,
        min_length = 1,
        max_length = 128,
        pattern = TRAINING_REQUEST_ID_PATTERN,
    ),
    current_subject: str = Depends(get_current_subject),

View on GitHub (pinned to 203007d190)

Solutions

  1. Poll GET /training/start-requests/{id} until the state reported is ready for acknowledgement, then ack
  2. Treat a repeated 409 on ack as 'already acknowledged' and verify via the status record's state field
  3. If the request is terminal (completed/failed/cancelled), stop acking and branch on the terminal state

Example fix

// before
client.post(f"/training/start-requests/{id}/acknowledge")  # 409

// after
status = client.get(f"/training/start-requests/{id}").json()
if status["state"] == "awaiting_acknowledgement":
    client.post(f"/training/start-requests/{id}/acknowledge")
Defensive patterns

Strategy: validation

Validate before calling

def ready_to_acknowledge(state: str) -> bool:
    return state == "awaiting_acknowledgement"  # align with backend state names

Try / catch

resp = client.post(f"/training/start-requests/{rid}/acknowledge")
if resp.status_code == 409:
    state = client.get(f"/training/start-requests/{rid}").json()["state"]
    if state in ("completed", "failed", "cancelled", "acknowledged"):
        pass  # nothing to ack; proceed
    else:
        retry_later()

Prevention

When it happens

Trigger: Calling acknowledge before the start request reaches the ackable state; acknowledging twice; acknowledging a request that already succeeded, failed, or was cancelled.

Common situations: Client acknowledging immediately after submitting without polling for readiness; retry logic that re-acks after a timeout even though the first ack succeeded.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/c229dd530721813a. Report an issue: GitHub.