{"record":{"id":"649281617e818d33","repo":"n8n-io/n8n","slug":"task-failed-errorcode-errormessage-649281","errorCode":null,"errorMessage":"Task failed: [${errorCode}] ${errorMessage}","messagePattern":"Task failed: \\[(.+?)\\] (.+?)","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/MiniMax/transport/index.ts","lineNumber":65,"sourceCode":"const MAX_POLL_ATTEMPTS = 60;\n\nexport async function pollVideoTask(\n\tthis: IExecuteFunctions,\n\ttaskId: string,\n\tpollIntervalMs: number = DEFAULT_POLL_INTERVAL_MS,\n): Promise<{ fileId: string; status: string }> {\n\tfor (let attempt = 0; attempt < MAX_POLL_ATTEMPTS; attempt++) {\n\t\tconst response = await apiRequest.call(this, 'GET', '/query/video_generation', {\n\t\t\tqs: { task_id: taskId },\n\t\t});\n\n\t\tconst status = response?.status as string;\n\n\t\tif (VIDEO_TERMINAL_STATUSES.includes(status)) {\n\t\t\tif (status === 'Fail') {\n\t\t\t\tconst errorCode = response?.base_resp?.status_code || 'UNKNOWN';\n\t\t\t\tconst errorMessage = response?.base_resp?.status_msg || 'Video generation task failed';\n\t\t\t\tthrow new NodeOperationError(this.getNode(), `Task failed: [${errorCode}] ${errorMessage}`);\n\t\t\t}\n\n\t\t\tconst fileId = response?.file_id as string;\n\t\t\tif (!fileId) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t'Video generation succeeded but no file_id was returned',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn { fileId, status };\n\t\t}\n\n\t\tawait sleep(pollIntervalMs);\n\t}\n\n\tthrow new NodeOperationError(\n\t\tthis.getNode(),","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/MiniMax/transport/index.ts#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// The task-failed verdict comes from the upstream render stage, so caller-side\n// validation is about preventing the inputs that typically cause it.\nfunction preflightVideoInputs(opts: { prompt?: string; referenceImageUrl?: string }) {\n  if (opts.prompt && /violence|explicit/i.test(opts.prompt)) {\n    return 'prompt may trigger content moderation; consider rephrasing';\n  }\n  if (opts.referenceImageUrl) {\n    try { new URL(opts.referenceImageUrl); } catch { return 'referenceImageUrl is not a valid URL'; }\n  }\n  return null;\n}","typeGuard":"function isTaskFailedResponse(r: unknown): r is { status: 'Fail'; base_resp: { status_code?: number; status_msg?: string } } {\n  return (r as { status?: string })?.status === 'Fail';\n}","tryCatchPattern":"try {\n  const { fileId } = await pollVideoTask.call(this, taskId);\n} catch (error) {\n  if (error instanceof NodeOperationError && /^Task failed:/.test(error.message)) {\n    // Render-stage failure: do NOT retry the same task — fix inputs and resubmit a new task.\n    throw error;\n  }\n  throw error;\n}","preventionTips":["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."],"tags":["minimax","video-generation","polling","task-failed","content-moderation"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}