n8n-io/n8n · error · NodeOperationError
Task failed: [${errorCode}] ${errorMessage}
Error message
Task failed: [${errorCode}] ${errorMessage} What it means
Thrown by pollVideoTask in the MiniMax transport when the GET /query/video_generation response reports a terminal status of 'Fail'. The error embeds base_resp.status_code (defaulting to 'UNKNOWN') and status_msg (defaulting to 'Video generation task failed'). This means MiniMax accepted the task but the rendering job itself failed asynchronously.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vendors/MiniMax/transport/index.ts:65
const MAX_POLL_ATTEMPTS = 60;
export async function pollVideoTask(
this: IExecuteFunctions,
taskId: string,
pollIntervalMs: number = DEFAULT_POLL_INTERVAL_MS,
): Promise<{ fileId: string; status: string }> {
for (let attempt = 0; attempt < MAX_POLL_ATTEMPTS; attempt++) {
const response = await apiRequest.call(this, 'GET', '/query/video_generation', {
qs: { task_id: taskId },
});
const status = response?.status as string;
if (VIDEO_TERMINAL_STATUSES.includes(status)) {
if (status === 'Fail') {
const errorCode = response?.base_resp?.status_code || 'UNKNOWN';
const errorMessage = response?.base_resp?.status_msg || 'Video generation task failed';
throw new NodeOperationError(this.getNode(), `Task failed: [${errorCode}] ${errorMessage}`);
}
const fileId = response?.file_id as string;
if (!fileId) {
throw new NodeOperationError(
this.getNode(),
'Video generation succeeded but no file_id was returned',
);
}
return { fileId, status };
}
await sleep(pollIntervalMs);
}
throw new NodeOperationError(
this.getNode(),View on GitHub (pinned to 5ac6606e81)
Solutions
- Read the embedded [errorCode] and errorMessage for the specific render-stage reason.
- Adjust the prompt and/or reference image to avoid moderation, then resubmit.
- Try a lower resolution or different model to rule out render-farm constraints.
- Check the MiniMax console for account-level rate/quality limits.
- If the errorCode looks internal, retry after a short backoff.
Defensive patterns
Strategy: try-catch
Validate before calling
// The task-failed verdict comes from the upstream render stage, so caller-side
// validation is about preventing the inputs that typically cause it.
function preflightVideoInputs(opts: { prompt?: string; referenceImageUrl?: string }) {
if (opts.prompt && /violence|explicit/i.test(opts.prompt)) {
return 'prompt may trigger content moderation; consider rephrasing';
}
if (opts.referenceImageUrl) {
try { new URL(opts.referenceImageUrl); } catch { return 'referenceImageUrl is not a valid URL'; }
}
return null;
} Type guard
function isTaskFailedResponse(r: unknown): r is { status: 'Fail'; base_resp: { status_code?: number; status_msg?: string } } {
return (r as { status?: string })?.status === 'Fail';
} Try / catch
try {
const { fileId } = await pollVideoTask.call(this, taskId);
} catch (error) {
if (error instanceof NodeOperationError && /^Task failed:/.test(error.message)) {
// Render-stage failure: do NOT retry the same task — fix inputs and resubmit a new task.
throw error;
}
throw error;
} Prevention
- Preflight prompts and reference images against obvious moderation triggers before submitting.
- Use a lower resolution or shorter duration to reduce render-farm failure surface.
- Capture the embedded errorCode/status_msg to classify whether the failure is retryable.
- Do not retry the same task_id after a Fail verdict — resubmit with corrected inputs.
When it happens
Trigger: Content moderation rejected the render mid-flight; reference image (i2v) deemed unsafe after deeper analysis; rendering engine error (codec, resolution mismatch, OOM on the render farm); resource limits exceeded for the account.
Common situations: Prompt passes initial check but fails secondary moderation; i2v reference image triggers safety review; unsupported resolution/model combination that passed validation but failed rendering; transient render-farm failure.
Related errors
- Video generation succeeded but no file_id was returned
- Video task ${taskId} did not complete within the maximum pol
- Task failed: [${errorCode}] ${errorMessage}
- Video generation task was canceled
- Task ${taskId} did not complete within the maximum polling t
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/649281617e818d33.
Report an issue: GitHub.