{"record":{"id":"3d183de7981a8cc7","repo":"vercel/ai","slug":"luma-ai-only-supports-url-based-images-please-pro","errorCode":null,"errorMessage":"Luma AI only supports URL-based images. Please provide image URLs using `prompt.images` with publicly accessible URLs. Base64 and Uint8Array data are not supported.","messagePattern":"Luma AI only supports URL-based images\\. Please provide image URLs using `prompt\\.images` with publicly accessible URLs\\. Base64 and Uint8Array data are not supported\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/luma/src/luma-image-model.ts","lineNumber":249,"sourceCode":"    const options: Record<string, unknown> = {};\n\n    // Luma does not support mask-based inpainting\n    if (mask != null) {\n      throw new Error(\n        'Luma AI does not support mask-based image editing. ' +\n          'Use the prompt to describe the changes you want to make, along with ' +\n          '`prompt.images` containing the source image URL.',\n      );\n    }\n\n    if (files == null || files.length === 0) {\n      return options;\n    }\n\n    // Validate all files are URL-based\n    for (const file of files) {\n      if (file.type !== 'url') {\n        throw new Error(\n          'Luma AI only supports URL-based images. ' +\n            'Please provide image URLs using `prompt.images` with publicly accessible URLs. ' +\n            'Base64 and Uint8Array data are not supported.',\n        );\n      }\n    }\n\n    // Default weights per reference type\n    const defaultWeights: Record<LumaReferenceType, number> = {\n      image: 0.85,\n      style: 0.8,\n      character: 1.0, // Not used, but defined for completeness\n      modify_image: 1.0,\n    };\n\n    switch (referenceType) {\n      case 'image': {\n        // Supports up to 4 images","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/luma/src/luma-image-model.ts#L231-L267","documentation":"Thrown by getEditingOptions when any provided input image is not URL-based (base64 or Uint8Array data). Luma's image editing API only accepts publicly accessible image URLs, so the SDK validates file types before the request and rejects binary image data with this error.","triggerScenarios":"Calling generateImage with a luma image model where prompt.images (or editing input files) contains a data-URI/base64 image or a Uint8Array/binary File instead of a { type: 'url', url } entry.","commonSituations":"Passing a locally uploaded file or Buffer read from disk directly into the edit request; reusing code written for OpenAI-style APIs that accept binary image data; images generated in-memory from a previous step being fed straight back in.","solutions":["Host the image at a publicly accessible URL (S3, GCS, Vercel Blob, etc.) and pass that URL in prompt.images.","If the image comes from a previous generation, use the returned image's hosted URL instead of the raw bytes.","Convert binary data to a URL by uploading via a storage presign flow before calling the model.","Switch to a provider that accepts binary image input if URL-only is not workable."],"exampleFix":"// before\nconst bytes = await fs.readFile('source.png');\nawait generateImage({ model: luma.image('photon-flash-1'), prompt: { text: 'make it night', images: [{ type: 'binary', data: bytes }] } });\n// after\nconst { url } = await put('source.png', await fs.readFile('source.png'));\nawait generateImage({ model: luma.image('photon-flash-1'), prompt: { text: 'make it night', images: [{ type: 'url', url }] } });","handlingStrategy":"validation","validationCode":"function assertUrlImages(images) {\n  for (const img of images ?? []) {\n    if (img.type !== 'url' || typeof img.url !== 'string' || !img.url.startsWith('http')) {\n      throw new Error('Luma requires publicly accessible image URLs for prompt.images');\n    }\n  }\n}","typeGuard":"function isUrlImage(img: { type: string }): img is { type: 'url'; url: string } {\n  return img.type === 'url' && typeof (img as { url?: unknown }).url === 'string';\n}","tryCatchPattern":"try {\n  await generateImage({ model: lumaImage, prompt });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('only supports URL-based images')) {\n    const hosted = await Promise.all(prompt.images.map(uploadAndGetUrl));\n    return generateImage({ model: lumaImage, prompt: { ...prompt, images: hosted } });\n  }\n  throw e;\n}","preventionTips":["Upload all binary/local images to public storage before invoking Luma edits.","Reuse the hosted URL returned by prior generateImage calls instead of raw bytes.","Validate image input types at the boundary of your editing feature.","Document the URL-only constraint wherever Luma image models are wired up."],"tags":["unsupported-feature","image-input","url-required","luma"],"backgroundTag":"image-input-format-unsupported","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}