n8n-io/n8n · error · NodeOperationError
Image generation failed: ${response.base_resp?.status_msg ||
Error message
Image generation failed: ${response.base_resp?.status_msg || 'Unknown error'} What it means
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.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vendors/MiniMax/actions/image/generate.operation.ts:142
aspect_ratio: aspectRatio,
n: numberOfImages,
response_format: 'url',
};
if (options.promptOptimizer !== undefined) {
body.prompt_optimizer = options.promptOptimizer;
}
if (options.seed !== undefined) {
body.seed = options.seed;
}
const response = (await apiRequest.call(this, 'POST', '/image_generation', {
body,
})) as ImageGenerationResponse;
if (response.base_resp?.status_code !== 0) {
throw new NodeOperationError(
this.getNode(),
`Image generation failed: ${response.base_resp?.status_msg || 'Unknown error'}`,
);
}
const imageUrls = response.data?.image_urls ?? [];
if (imageUrls.length === 0) {
throw new NodeOperationError(this.getNode(), 'No images were generated');
}
const results: INodeExecutionData[] = [];
for (let idx = 0; idx < imageUrls.length; idx++) {
const imageUrl = imageUrls[idx];
if (downloadImage) {
const imageResponse = await this.helpers.httpRequest({
method: 'GET',View on GitHub (pinned to 5ac6606e81)
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.
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_ASPECT_RATIOS = ['1:1', '3:4', '4:3', '16:9', '9:16'] as const;
function validateImageGenInput(opts: { prompt?: string; model?: string; aspectRatio?: string; seed?: number }) {
if (!opts.prompt || opts.prompt.trim().length === 0) return 'prompt is required';
if (opts.prompt.length > 1500) return `prompt length ${opts.prompt.length} likely exceeds the limit`;
if (opts.aspectRatio && !SUPPORTED_ASPECT_RATIOS.includes(opts.aspectRatio as never)) {
return `aspect_ratio '${opts.aspectRatio}' is not recognized`;
}
if (opts.seed !== undefined && (!Number.isInteger(opts.seed) || opts.seed < 0)) return 'seed must be a non-negative integer';
return null;
} Type guard
function isImageGenSuccessResponse(r: unknown): r is { base_resp: { status_code: 0 }; data: { image_urls: string[] } } {
const b = (r as { base_resp?: { status_code?: number } })?.base_resp;
const urls = (r as { data?: { image_urls?: unknown[] } })?.data?.image_urls;
return !!b && b.status_code === 0 && Array.isArray(urls) && urls.length > 0;
} Try / catch
const response = (await apiRequest.call(this, 'POST', '/image_generation', { body })) as ImageGenerationResponse;
if (response.base_resp?.status_code !== 0) {
throw new NodeOperationError(
this.getNode(),
`Image generation failed: ${response.base_resp?.status_msg || 'Unknown error'}`,
);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Text-to-speech failed: ${response.base_resp?.status_msg || '
- No images were generated
- Failed to create video task: ${createResponse.base_resp?.sta
- Failed to create video task: ${createResponse.base_resp?.sta
- Task failed: [${errorCode}] ${errorMessage}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/109d847bdddc0064.
Report an issue: GitHub.