Generation and delivery have different retry costs
The same stored output can be retrieved when the request is authorized and the completed job still exposes its content route. Your application should track remote completion separately from local file persistence. A failed disk write, interrupted connection or HTML error saved as MP4 belongs to delivery investigation, not automatically another paid creative attempt. Do not import another provider's link-expiry or retention duration into this route; use the actual AISwapLab response and contract.
What to do next
- 01
Confirm the existing state
Poll the known job and check completed plus content_url. If the state is still saving or unknown, resolve that state before treating the problem as a finished-file transfer.
- 02
Validate the download response
Check HTTP status, Content-Type and non-empty bytes. Use a temporary local filename, then finalize it only after a complete validated transfer.
- 03
Recover transfer deliberately
Repeat the GET or use a supported byte range when appropriate. Keep retry count bounded and preserve the same job record so the UI does not create an accidental replacement task.
A concrete example
Illustrative failure: a 4K image finishes, but the customer's laptop loses Wi-Fi halfway through saving. The backend redownloads that job's content and verifies the file; it does not request a second 4K image.
Retry the existing artifact
| Observed delivery problem | Same-job recovery | Stop condition |
|---|---|---|
| Interrupted network or local disk write | Retrieve the existing owned completed content into a staging file | Retry budget exhausted or repeated storage fault |
| 401/403 or unexpected content | Investigate credential/permission and response type | Do not accept an error body as media |
| Completed status but result unavailable | Preserve job and safe response for support | Do not mask the missing artifact with a new generation |
Before you call it ready
- The original job remains the source of truth.
- Only delivery is retried.
- Error bodies are not accepted as media files.
When to stop or choose another method
If the stored result is unavailable despite completed status, report the existing job and safe error. Repeated generation can conceal the delivery fault while adding unnecessary charges.
