{"record":{"id":"109d847bdddc0064","repo":"n8n-io/n8n","slug":"image-generation-failed-response-base-resp-sta","errorCode":null,"errorMessage":"Image generation failed: ${response.base_resp?.status_msg || 'Unknown error'}","messagePattern":"Image generation failed: (.+?)","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/MiniMax/actions/image/generate.operation.ts","lineNumber":142,"sourceCode":"\t\taspect_ratio: aspectRatio,\n\t\tn: numberOfImages,\n\t\tresponse_format: 'url',\n\t};\n\n\tif (options.promptOptimizer !== undefined) {\n\t\tbody.prompt_optimizer = options.promptOptimizer;\n\t}\n\n\tif (options.seed !== undefined) {\n\t\tbody.seed = options.seed;\n\t}\n\n\tconst response = (await apiRequest.call(this, 'POST', '/image_generation', {\n\t\tbody,\n\t})) as ImageGenerationResponse;\n\n\tif (response.base_resp?.status_code !== 0) {\n\t\tthrow new NodeOperationError(\n\t\t\tthis.getNode(),\n\t\t\t`Image generation failed: ${response.base_resp?.status_msg || 'Unknown error'}`,\n\t\t);\n\t}\n\n\tconst imageUrls = response.data?.image_urls ?? [];\n\tif (imageUrls.length === 0) {\n\t\tthrow new NodeOperationError(this.getNode(), 'No images were generated');\n\t}\n\n\tconst results: INodeExecutionData[] = [];\n\n\tfor (let idx = 0; idx < imageUrls.length; idx++) {\n\t\tconst imageUrl = imageUrls[idx];\n\n\t\tif (downloadImage) {\n\t\t\tconst imageResponse = await this.helpers.httpRequest({\n\t\t\t\tmethod: 'GET',","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/MiniMax/actions/image/generate.operation.ts#L124-L160","documentation":"Thrown after POST /image_generation when response.base_resp.status_code is non-zero. Identical pattern to the TTS failure: MiniMax uses base_resp for application-level errors and status_msg carries the detail, with 'Unknown error' as the fallback.","triggerScenarios":"Prompt triggers content moderation; model or aspect_ratio parameter unsupported for the account; prompt_optimizer/seed values out of allowed range; account out of image-generation credits; API key lacks image permission.","commonSituations":"Prompt contains disallowed content; aspect ratio not available on the free tier; account quota exhausted; rotated API key without image scope; using a model identifier deprecated by MiniMax.","solutions":["Read status_msg from the error text for the exact upstream reason.","Simplify the prompt and remove any potentially moderated content, then retry.","Verify model and aspect_ratio are supported for your account tier in MiniMax docs.","Check image-generation credit balance and API key scopes.","Drop optional fields (prompt_optimizer, seed) one at a time to isolate a rejected parameter."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const SUPPORTED_ASPECT_RATIOS = ['1:1', '3:4', '4:3', '16:9', '9:16'] as const;\nfunction validateImageGenInput(opts: { prompt?: string; model?: string; aspectRatio?: string; seed?: number }) {\n  if (!opts.prompt || opts.prompt.trim().length === 0) return 'prompt is required';\n  if (opts.prompt.length > 1500) return `prompt length ${opts.prompt.length} likely exceeds the limit`;\n  if (opts.aspectRatio && !SUPPORTED_ASPECT_RATIOS.includes(opts.aspectRatio as never)) {\n    return `aspect_ratio '${opts.aspectRatio}' is not recognized`;\n  }\n  if (opts.seed !== undefined && (!Number.isInteger(opts.seed) || opts.seed < 0)) return 'seed must be a non-negative integer';\n  return null;\n}","typeGuard":"function isImageGenSuccessResponse(r: unknown): r is { base_resp: { status_code: 0 }; data: { image_urls: string[] } } {\n  const b = (r as { base_resp?: { status_code?: number } })?.base_resp;\n  const urls = (r as { data?: { image_urls?: unknown[] } })?.data?.image_urls;\n  return !!b && b.status_code === 0 && Array.isArray(urls) && urls.length > 0;\n}","tryCatchPattern":"const response = (await apiRequest.call(this, 'POST', '/image_generation', { body })) as ImageGenerationResponse;\nif (response.base_resp?.status_code !== 0) {\n  throw new NodeOperationError(\n    this.getNode(),\n    `Image generation failed: ${response.base_resp?.status_msg || 'Unknown error'}`,\n  );\n}","preventionTips":["Sanitize/soften prompts to avoid content-moderation rejection before sending.","Validate aspect_ratio and model against the account tier before deploying.","Monitor image-generation credits and alert before exhaustion.","Always surface upstream status_msg so users see the real rejection reason."],"tags":["minimax","image-generation","api-error","content-moderation"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}