n8n-io/n8n · error · NodeOperationError
Task failed: [${errorCode}] ${errorMessage}
Error message
Task failed: [${errorCode}] ${errorMessage} What it means
Thrown by pollTaskResult when the AlibabaCloud DashScope task API returns a terminal status of 'FAILED'. The polling loop checks task_status against TERMINAL_STATUSES; when it equals 'FAILED', the code extracts the error code and message from the response (checking output.code/output.message first, then top-level code/message, with 'UNKNOWN' and a generic message as fallbacks) and throws a NodeOperationError with the formatted error string.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vendors/AlibabaCloud/transport/index.ts:82
* @param pollIntervalMs - Interval between polls in milliseconds. Defaults to 15 seconds.
* @returns The final task response containing video_url on success.
*/
export async function pollTaskResult(
this: IExecuteFunctions,
taskId: string,
pollIntervalMs: number = DEFAULT_POLL_INTERVAL_MS,
): Promise<IDataObject> {
for (let attempt = 0; attempt < MAX_POLL_ATTEMPTS; attempt++) {
const response = await apiRequest.call(this, 'GET', `/api/v1/tasks/${taskId}`);
const taskStatus = response?.output?.task_status as string;
if (TERMINAL_STATUSES.includes(taskStatus)) {
if (taskStatus === 'FAILED') {
const errorCode = response?.output?.code || response?.code || 'UNKNOWN';
const errorMessage =
response?.output?.message || response?.message || 'Video generation task failed';
throw new NodeOperationError(this.getNode(), `Task failed: [${errorCode}] ${errorMessage}`);
}
if (taskStatus === 'CANCELED') {
throw new NodeOperationError(this.getNode(), 'Video generation task was canceled');
}
// SUCCEEDED
return response as IDataObject;
}
// Wait before next poll
await sleep(pollIntervalMs);
}
throw new NodeOperationError(
this.getNode(),
`Task ${taskId} did not complete within the maximum polling time. Last status was not terminal. You can query the task manually using the task ID.`,
);View on GitHub (pinned to 5ac6606e81)
Solutions
- Read the errorCode and errorMessage in the thrown error — format is 'Task failed: [CODE] MESSAGE' which maps to DashScope's error taxonomy.
- If the error is content-policy related, modify the prompt or input image to comply with Alibaba Cloud's content guidelines.
- Retry the task — transient internal failures may succeed on retry.
- Reduce input complexity (lower resolution, shorter duration) if the error suggests resource limits.
- Check Alibaba Cloud DashScope status page for ongoing service incidents.
Defensive patterns
Strategy: try-catch
Try / catch
try {
const result = await pollTaskResult.call(this, taskId);
// ... process result ...
} catch (error) {
if (error instanceof NodeOperationError && error.message.startsWith('Task failed:')) {
const match = error.message.match(/\[(\w+)] (.+)/);
const errorCode = match?.[1];
const errorMsg = match?.[2];
// handle based on error code, e.g. retry for transient errors
}
throw error;
} Prevention
- Avoid prompts or images that may trigger content moderation filters during video rendering.
- Use supported resolution/duration combinations to avoid processing failures.
- Retry once for transient FAILED statuses — some failures are sporadic.
- Monitor DashScope error codes in the error message to identify recurring patterns.
- Keep inputs simple initially and increase complexity gradually.
When it happens
Trigger: An asynchronous video generation task reached FAILED status on the DashScope side. This is the API reporting that the actual video generation work failed after the task was successfully created and accepted. Common causes include content policy violations during rendering, internal model errors, resource constraints, or invalid input data discovered during processing.
Common situations: The prompt or image content passes initial validation but is rejected during actual generation; the model encounters an internal error processing the specific input; the input image is too large or has an unsupported aspect ratio for the requested resolution; concurrent task limits exceeded.
Related errors
- Video generation task was canceled
- Task ${taskId} did not complete within the maximum polling t
- Failed to create video generation task: ${createResponse?.me
- Failed to create video generation task: ${createResponse?.me
- Task failed: [${errorCode}] ${errorMessage}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/d6afdf69f770fbb1.
Report an issue: GitHub.