ruvnet/RuView · warning · HTTPException
Calibration already in progress
Error message
Calibration already in progress
What it means
HTTP 409 from POST /pose/calibrate when pose_service.is_calibrating() is true — only one calibration may run at a time. The response advertises an estimated ~5-minute duration, so the conflict window is minutes, not milliseconds. The check runs before start_calibration and the handler re-raises the HTTPException unchanged.
Source
Thrown at archive/v1/src/api/routers/pose.py:333
status_code=500,
detail="An internal error occurred. Please try again later."
)
@router.post("/calibrate")
async def calibrate_pose_system(
background_tasks: BackgroundTasks,
pose_service: PoseService = Depends(get_pose_service),
hardware_service: HardwareService = Depends(get_hardware_service),
current_user: Dict = Depends(require_auth)
):
"""Calibrate the pose estimation system."""
try:
logger.info(f"Pose system calibration initiated by user: {current_user['id']}")
# Check if calibration is already in progress
if await pose_service.is_calibrating():
raise HTTPException(
status_code=409,
detail="Calibration already in progress"
)
# Start calibration process
calibration_id = await pose_service.start_calibration()
# Schedule background calibration task
background_tasks.add_task(
pose_service.run_calibration,
calibration_id
)
return {
"calibration_id": calibration_id,
"status": "started",
"estimated_duration_minutes": 5,
"message": "Calibration process started"View on GitHub (pinned to 4685618388)
Solutions
- Poll GET /pose/calibration/status until is_calibrating is false, then POST again
- Disable the calibrate control client-side while a run is active (see exampleFix)
- If status shows a stuck calibration (progress not advancing), restart the service to clear the flag
Example fix
// before
btn.onclick = () => api.post('/pose/calibrate');
// after
const st = await api.get('/pose/calibration/status');
if (!st.is_calibrating) {
btn.disabled = true;
try { await api.post('/pose/calibrate'); }
finally { btn.disabled = false; }
} Defensive patterns
Strategy: validation
Validate before calling
st = (await client.get('/pose/calibration/status')).json()
if st.get('is_calibrating'):
raise CalibrationInProgress(st.get('estimated_remaining_minutes'))
await client.post('/pose/calibrate') Type guard
def calibration_is_idle(status) -> bool:
return isinstance(status, dict) and not status.get('is_calibrating', False) Try / catch
resp = await client.post('/pose/calibrate')
if resp.status_code == 409:
st = (await client.get('/pose/calibration/status')).json()
await wait_until(lambda: not get_status()['is_calibrating'], timeout=15 * 60)
resp = await client.post('/pose/calibrate')
resp.raise_for_status() Prevention
- Disable the calibrate control while status.is_calibrating is true
- Never auto-retry POST /calibrate on client timeout — the first request may have started a run
- Poll /calibration/status rather than guessing when the ~5-minute run finishes
When it happens
Trigger: A second POST /pose/calibrate while a previous calibration is still running — a double-click on the calibrate button, two operators calibrating concurrently, or a client-timeout retry while the first run is in progress.
Common situations: UI without a disabled state during calibration; scripts auto-retrying on timeout even though the first request succeeded; an abandoned calibration run that never cleared the in-progress flag.
Related errors
- JWT authentication is not configured. In development mode, e
- Authentication required
- Unknown service: {service_name}
- Page must be >= 1
- Size must be >= 1
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/fcc0ca1eb86af217.
Report an issue: GitHub.