GPT Image 2.5 is live — OpenAI's newest image model, targeted edits that leave the rest of the frame alone
All resources

· reAPI Team

API 500 errors: when to retry a video request

Handle API 500 errors without duplicating paid video jobs. Check whether submission succeeded, recover task IDs, limit retries, and restart workflows safely.

API 500 errors: when to retry a video request

One click, an error message, then another click. In a video application, that can be enough to create two paid generations while the interface still shows a failure.

Consider a hypothetical request: the server accepts the first submission, starts a task and loses the response on its way back to the client. The client receives an error and submits again. If the endpoint creates a new task for each accepted submission, both jobs can continue. The second click did not repair the first response; it asked for another video.

This is the practical difficulty behind API 500 errors. AWS's retry guidance warns that a failed response or timeout does not establish that the operation had no side effects.[1] Before retrying a generation, find out what the failed request was doing and what evidence remains of its acceptance.

Find the request that failed

A message such as “Request failed with status code 500” identifies an HTTP result, not the state of the video. MDN defines 500 as an unexpected server condition that prevented fulfillment of the request.[2] It does not tell you which component failed, prove that every input was valid or promise that waiting will fix it.

Look at the method and URL in the client log. A failure on the generation POST has different consequences from a failure while fetching an existing task. A file download can fail after both of those operations succeeded. An interface that collapses all three into “generation failed” loses the distinction needed for recovery.

Keep the UTC time, model, status, response body and available request or task identifier. Redact credentials before sharing logs. If the response is HTML rather than the documented API error shape, retain that fact too; do not extract a guessed model failure from a generic error page.

For the hypothetical first click, the question is whether you have a task ID. Search the submission response saved by your server, the relevant workflow output and any documented callback record. Check the account or project that actually sent the request. A different dashboard account cannot settle whether this submission created a job.

With a task ID, continue from that task

If you recovered the identifier, use the provider's documented read operation. On reAPI, GET /api/v1/tasks/{id} retrieves the task without consuming credits.[3] It is the appropriate place to resume observation; sending the original generation body again creates a separate submission.

Read the task state inside the response. reAPI returns HTTP 200 when a task is found, including when that task's state is failed.[4] HTTP 200 therefore does not mean the video succeeded. Equally, a 500 from the lookup does not establish that the video failed. It means that lookup did not give you a usable answer.

A completed task should be handled through its documented output fields. Save the file you need rather than leaving the application waiting for a second generation. A processing task remains under observation. For a failed task, read the error and settlement information before deciding whether a new attempt makes sense.

The failed task and its bill are related but distinct. reAPI documents refunded failures and model-specific cases where a post-generation safety check can block an output after chargeable generation occurred.[3] Preserve the actual task's usage record. A general “server error” banner is not evidence that every charge should disappear; failed-generation billing needs the terminal task and the applicable policy.

Without an ID, leave acceptance unresolved

The harder case is the first click with no usable submission response. Give that operation an explicit unresolved state in your application. For example, an internal acceptance_unknown value can distinguish it from work that was never sent and work that the provider confirmed as failed. This is a suggested application state, not a field every API returns.

Keep a stable local operation ID and one recovery owner. The owner can reconcile whatever evidence the integration actually provides: saved responses, callbacks, authorized task history or support findings. If a task is identified later, attach it to the original operation and continue from there.

An empty local task-ID column proves only that your application did not save an ID. The response might have been lost after acceptance. Likewise, your local operation ID does not automatically reach the provider or make its creation endpoint deduplicate requests. It helps organize your evidence; it is not proof of exactly-once execution.

Be equally careful with an Idempotency-Key header. HTTP POST is not inherently idempotent, and repeat safety depends on the endpoint's actual contract.[5] reAPI explicitly says it records this header but does not use it to deduplicate generations. Repeating an accepted POST with the same key can create another task and another charge.[6]

If the evidence remains inconclusive, an intentional replacement may still be a business decision. Record it as another attempt associated with the unresolved original, with the possibility that both complete. Do not silently change the first attempt to “not created” just to make the retry queue simpler. That erases the very record needed when a late result or charge arrives.

Check what n8n will repeat

The same ambiguity is easy to miss in a workflow editor. A node labeled “Generate Video” may submit work and then wait for it. A red node can mean its waiting period ended, while the remote prediction continues.

WaveSpeed's official n8n integration describes precisely this behavior: the generation node submits a prediction and waits for the result. A positive timeout can fail the node while the prediction keeps running. Its documentation warns that n8n's Retry On Fail reruns the whole node, producing a new, separately billed prediction; transient polling failures are already retried internally.[7] That warning applies to this integration, not automatically to every community node.

For a workflow built with HTTP Request nodes, inspect the action of the node configured to retry. n8n documents Retry on Fail at node level.[8] If that node sends the generation POST, another attempt sends that POST again. If it only reads a known task, the repeated action is the read. The workflow's visible error text cannot substitute for examining the node.

A useful design is to persist the accepted task ID between submission and polling. Recovery can then resume the read step without traversing creation again. This does not remove the lost-submission-response case described above; keep that unresolved path separately. Manually rerunning an entire execution also deserves the same inspection, because successful earlier creation steps may run again.

Return to the hypothetical double click: replacing the second click with an automatic node retry has not changed the billing problem. The application still needs to know whether it is asking about the original job or requesting a new one.

Retry the read with a stopping point

A temporary failure while reading a known task is a more straightforward retry candidate. Keep the same task identity, use the endpoint's documented polling and rate-limit rules, and stop the immediate retry loop when its allowed attempts or elapsed-time budget is exhausted.

AWS describes capped exponential backoff, jitter and limits on attempts to avoid hammering a struggling dependency.[1] Jitter spreads clients' next attempts instead of scheduling all of them for the same instant. These techniques manage retry load; they do not turn a creation POST into a deduplicated operation.

Choose one layer to own this recovery. If an SDK, workflow node and outer worker each repeat independently, the resulting traffic can exceed what the outer setting suggests. Review the retries already built into the integration before adding another loop around it.

When the read budget ends, preserve the task ID for later reconciliation. A client deadline says how long that client waited. Unless a documented cancellation operation succeeded, it does not establish that remote generation stopped. Show an unresolved retrieval state rather than offering an unqualified “try again” button that submits fresh work.

Use the specific error before choosing a replacement

Once you have a structured error, read its code and documented scope. reAPI, for example, identifies 60001 and 60002 as failures to persist a task or start a workflow, with credits refunded.[4] Those documented cases support a different recovery decision from an unknown HTML 500 response or a lost connection after submission. Do not extend their refund behavior to every server error.

If the specific response identifies an invalid input or unusable media, correct the identified problem against that endpoint's documentation before submitting another attempt. Preserve the original attempt's evidence and treat the corrected submission as new work; changing an input does not resolve an earlier unknown acceptance.

“The server is currently unable to handle this request” is similarly incomplete without the HTTP status and response details. Repeatedly changing the prompt, refreshing a browser or increasing the timeout does not identify where a server-side failure occurred. For a provider-managed endpoint, supply the method, URL, UTC time and available identifiers through its support process; reAPI's error guide specifies this evidence.[4]

A different provider may be a useful replacement when its supported inputs, output and operating conditions fit the task. But a different hostname alone does not prove an independent failure path. Nor does a successful replacement settle what happened to the original submission. Keep both attempts visible, including any original task that finishes later.

Before resuming a backlog, account for the work already sent. Known tasks need continued observation or a recorded outcome; unknown submissions need an owner and an explicit decision about replacement. The first successful retry is useful, but the recovery is only understandable when you can explain which remote jobs may exist for each user request.

References

  1. AWS Builders Library: Timeouts, retries, and backoff with jitter. Engineering guidance first published in 2019; side effects, bounded retries and retry amplification.
  2. MDN: HTTP 500 Internal Server Error. Definition and server-side investigation.
  3. reAPI Tasks. Polling, status, output and settlement semantics.
  4. reAPI Errors. Specific failure codes and support evidence. Retry decisions here also apply the submission contract in reference 6.
  5. MDN: Idempotent. HTTP method semantics and the limits of assuming repeat safety.
  6. reAPI API overview. Generation submission and the Idempotency-Key contract.
  7. WaveSpeed official n8n Integration documentation. Node timeout, whole-node retries and separately billed predictions; retrieved November 15, 2026.
  8. n8n official HTTP Request common-issues documentation. Retry on Fail and node retry settings; retrieved November 15, 2026.
All resources