vercel/ai · error · Error

Unsupported task type: ${taskType}

Error message

Unsupported task type: ${taskType}

What it means

The Bedrock image model (Nova Canvas) maps ImageModelV4 prompt composition to Nova task types (TEXT_IMAGE, COLOR_GUIDED_GENERATION, IMAGE_VARIATION, INPAINT, OUTPAINT, etc.). The switch over taskType has no default mapping for the value computed, so doGenerate throws 'Unsupported task type'. This indicates an internal mapping gap, usually from an image editing mode the provider package doesn't yet translate.

Source

Thrown at packages/amazon-bedrock/src/amazon-bedrock-image-model.ts:220

              ? { negativeText: amazonBedrockOptions.negativeText }
              : {}),
            ...(amazonBedrockOptions?.similarityStrength != null
              ? {
                  similarityStrength: amazonBedrockOptions.similarityStrength,
                }
              : {}),
          };

          args = {
            taskType: 'IMAGE_VARIATION',
            imageVariationParams,
            imageGenerationConfig,
          };
          break;
        }

        default:
          throw new Error(`Unsupported task type: ${taskType}`);
      }
    } else {
      // Standard image generation mode
      args = {
        taskType: 'TEXT_IMAGE',
        textToImageParams: {
          text: prompt,
          ...(amazonBedrockOptions?.negativeText
            ? {
                negativeText: amazonBedrockOptions.negativeText,
              }
            : {}),
          ...(amazonBedrockOptions?.style
            ? {
                style: amazonBedrockOptions.style,
              }
            : {}),
        },

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Update @ai-sdk/amazon-bedrock to the latest version for expanded Nova Canvas task support
  2. Simplify the request to a supported mode — e.g. plain text-to-image via generateImage({ model, prompt })
  3. Check which editing inputs you're passing (images/masks) and align them with documented Nova Canvas modes
  4. If you need an unsupported task type, open an issue / file a PR against the bedrock image model

Example fix

// before
await generateImage({ model, prompt, images: [ref1, ref2] }); // unmapped editing combo
// after
await generateImage({ model, prompt }); // standard TEXT_IMAGE mode
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the editing mode you use is supported by the installed provider version
const supported = ['TEXT_IMAGE','COLOR_GUIDED_GENERATION','IMAGE_VARIATION','INPAINT','OUTPAINT'];

Try / catch

try {
  await generateImage({ model, prompt, images });
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Unsupported task type')) {
    // fall back to plain text-to-image or update the package
  }
}

Prevention

When it happens

Trigger: Calling generateImage with a bedrock image model using an editing mode (e.g. a new/unsupported combination of images + mask) that maps to a Nova taskType the package has no case for.

Common situations: Using image editing features (inpainting/outpainting/color-guided) added to the core SDK before @ai-sdk/amazon-bedrock added support; passing multiple reference images in a way that produces an unmapped task type; outdated provider package.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/df7cc75bcdf99c12. Report an issue: GitHub.