{"record":{"id":"d96aeb941e7013b5","repo":"vercel/ai","slug":"black-forest-labs-supports-up-to-10-input-images","errorCode":null,"errorMessage":"Black Forest Labs supports up to 10 input images.","messagePattern":"Black Forest Labs supports up to 10 input images\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/black-forest-labs/src/black-forest-labs-image-model.ts","lineNumber":129,"sourceCode":"    });\n\n    const [widthStr, heightStr] = size?.split('x') ?? [];\n\n    const inputImages: string[] =\n      files?.map(file => {\n        if (file.type === 'url') {\n          return file.url;\n        }\n\n        if (typeof file.data === 'string') {\n          return file.data;\n        }\n\n        return Buffer.from(file.data).toString('base64');\n      }) || [];\n\n    if (inputImages.length > 10) {\n      throw new Error('Black Forest Labs supports up to 10 input images.');\n    }\n\n    const inputImageField =\n      this.modelId === 'flux-pro-1.0-fill' ? 'image' : 'input_image';\n    const inputImagesObj: Record<string, string> = inputImages.reduce<\n      Record<string, string>\n    >((acc, img, index) => {\n      acc[`${inputImageField}${index === 0 ? '' : `_${index + 1}`}`] = img;\n      return acc;\n    }, {});\n\n    let maskValue: string | undefined;\n    if (mask) {\n      if (mask.type === 'url') {\n        maskValue = mask.url;\n      } else {\n        if (typeof mask.data === 'string') {\n          maskValue = mask.data;","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/black-forest-labs/src/black-forest-labs-image-model.ts#L111-L147","documentation":"Black Forest Labs image models (FLUX) accept at most 10 input images for image-to-image / editing operations. getArgs counts the provided images and throws when more than 10 are supplied.","triggerScenarios":"Calling generateImage with a flux model (e.g. flux-pro-1.0-fill or flux-kontext) and an images array containing 11 or more input images.","commonSituations":"Batch-editing many reference images at once; concatenating image sets without a cap; passing a folder's images in a loop.","solutions":["Limit the images array to 10 entries, batching the rest into separate requests.","Pre-select the most relevant reference images instead of sending all.","Split into multiple generateImage calls and merge results downstream."],"exampleFix":"// before\nawait generateImage({ model: flux, images: allTwentyImages });\n// after\nfor (const batch of chunk(allTwentyImages, 10)) {\n  await generateImage({ model: flux, images: batch });\n}","handlingStrategy":"validation","validationCode":"if (images.length > 10) {\n  throw new Error('FLUX accepts at most 10 input images; batch the rest');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await generateImage({ model: flux, images });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('up to 10 input images')) {\n    // re-run with images.slice(0, 10)\n  }\n}","preventionTips":["Cap reference-image arrays at 10 before calling generateImage.","Implement a chunking helper for batch image-editing workflows.","Curate reference images rather than sending every candidate."],"tags":["image-generation","validation","limits","black-forest-labs"],"backgroundTag":"input-limit-exceeded","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}