{"record":{"id":"7897e3f26fabfc51","repo":"vercel/ai","slug":"amazon-bedrock-returned-no-images-status-respo","errorCode":null,"errorMessage":"Amazon Bedrock returned no images. Status: ${response.status}","messagePattern":"Amazon Bedrock returned no images\\. Status: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/amazon-bedrock/src/amazon-bedrock-image-model.ts","lineNumber":286,"sourceCode":"      ),\n      abortSignal,\n      fetch: this.config.fetch,\n    });\n\n    // Handle moderated/blocked requests\n    if (response.status === 'Request Moderated') {\n      const moderationReasons = response.details?.['Moderation Reasons'];\n      const reasons = Array.isArray(moderationReasons)\n        ? moderationReasons\n        : ['Unknown'];\n      throw new Error(\n        `Amazon Bedrock request was moderated: ${reasons.join(', ')}`,\n      );\n    }\n\n    // Check if images are present\n    if (!response.images || response.images.length === 0) {\n      throw new Error(\n        'Amazon Bedrock returned no images. ' +\n          (response.status ? `Status: ${response.status}` : ''),\n      );\n    }\n\n    return {\n      images: response.images,\n      warnings,\n      response: {\n        timestamp: currentDate,\n        modelId: this.modelId,\n        headers: responseHeaders,\n      },\n    };\n  }\n}\n\nfunction getBase64Data(file: ImageModelV4File): string {","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/amazon-bedrock/src/amazon-bedrock-image-model.ts#L268-L304","documentation":"After the moderation check, the provider verifies the Nova Canvas response actually contains images. If response.images is missing or empty (for any status other than moderation), doGenerate throws 'Amazon Bedrock returned no images' with the response status appended. This guards against silent empty results from the provider.","triggerScenarios":"generateImage against a bedrock image model where the API responds successfully but with zero images — e.g. unacknowledged filtering, invalid generation config (width/height out of range), or quality/seed issues.","commonSituations":"Invalid imageGenerationConfig dimensions for the model; prompt rejected softly by the model; model returning an unusual status the package doesn't explicitly map; new Nova model versions with different response shapes on outdated provider packages.","solutions":["Update @ai-sdk/amazon-bedrock to the latest version","Validate your generation config (width/height/quality/count) against the Nova Canvas limits for your model ID","Simplify the prompt and retry to rule out soft filtering","Log/report the response.status from the error message; open an issue with AWS if a valid request consistently yields no images"],"exampleFix":"// before\nawait generateImage({ model, prompt: 'a cat', providerOptions: { bedrock: { imageGenerationConfig: { width: 99999, height: 99999 } } } });\n// after\nawait generateImage({ model, prompt: 'a cat', providerOptions: { bedrock: { imageGenerationConfig: { width: 1024, height: 1024 } } } });","handlingStrategy":"retry","validationCode":"// validate generation config against model limits, e.g. 320–4096 px for Nova Canvas\nguard(width >= 320 && width <= 4096 && height >= 320 && height <= 4096)","typeGuard":null,"tryCatchPattern":"try {\n  const { images } = await generateImage({ model, prompt });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('returned no images')) {\n    // adjust prompt/config and retry\n  }\n}","preventionTips":["Validate width/height/quality/count against Nova Canvas limits","Retry with a simplified prompt when generation returns empty","Update the provider package for newer model response shapes"],"tags":["bedrock","image-generation","empty-response"],"backgroundTag":"empty-generation-result","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}