Preview regenerate too early: 409 avatar_video_preview_busy, no charge

Calling regenerate on an avatar video preview that is still queued or processing returns 409 avatar_video_preview_busy and refunds the reservation. What to do.

3 min readSume
All posts

The scenario

You create a preview with POST /v1/avatar-video-previews and the first frame looks wrong. You call POST /v1/avatar-video-previews/:id/regenerate straight away, but the first preview job has not finished. The API answers 409 with code avatar_video_preview_busy.

What the response and the books look like

The message reads: Avatar video preview is still generating. Wait for it to finish before regenerating. The body gives the avatar_video_preview_id, a request_id for the failed regenerate job and a status_url. The next-action hint is to poll status.

The regenerate job is marked failed. When the call was not an idempotency replay, the code refunds the usage reservation with reason avatar_video_preview_busy, so a rejected early click does not cost you.

Fix: wait on the first job, then regenerate

Poll the job behind the preview until it is completed, then call regenerate. Use a new Idempotency-Key for the regenerate call.

curl https://api.sume.com/v1/jobs/$PREVIEW_JOB_ID/status \
  -H "Authorization: Bearer $SUME_API_KEY"

Related states

  • Preview stills do not depend on the quality tier, so regenerating a still is the cheap way to fix a bad first frame before the paid video.
  • Generating the final video before the preview completes is a different 409, avatar_video_preview_not_ready.
  • Poll with backoff and stop on completed, failed or canceled.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume