{"record":{"id":"a329c6389e25c174","repo":"vercel/ai","slug":"ai-nosuchmodelerror","errorCode":"AI_NoSuchModelError","errorMessage":"No such imageModel: ${modelId}","messagePattern":"No such imageModel: (.+?)","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/alibaba/src/alibaba-provider.ts","lineNumber":181,"sourceCode":"    if (new.target) {\n      throw new Error(\n        'The Alibaba model function cannot be called with the new keyword.',\n      );\n    }\n\n    return createLanguageModel(modelId);\n  };\n\n  provider.specificationVersion = 'v4' as const;\n  provider.languageModel = createLanguageModel;\n  provider.chatModel = createLanguageModel;\n  provider.embedding = createEmbeddingModel;\n  provider.embeddingModel = createEmbeddingModel;\n  provider.video = createVideoModel;\n  provider.videoModel = createVideoModel;\n\n  provider.imageModel = (modelId: string) => {\n    throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n  };\n\n  return provider;\n}\n\nexport const alibaba = createAlibaba();\n","sourceCodeStart":163,"sourceCodeEnd":188,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/alibaba/src/alibaba-provider.ts#L163-L188","documentation":"Alibaba's provider factory does not implement an imageModel factory, so provider.imageModel(modelId) unconditionally throws NoSuchModelError. The provider object implements the LanguageModelV4 provider spec where imageModel is optional and explicitly declared unsupported here.","triggerScenarios":"Calling alibaba.image('wanx-...') or alibaba.imageModel('wanx-...') — any imageModel lookup on the alibaba provider.","commonSituations":"Assuming every provider supports image generation because other providers (e.g. openai) do; copy-pasting model factory code across providers.","solutions":["Use alibaba.video('wan2.2-...') for video generation or check the provider's supported factory methods","Call the DashScope image API directly for Alibaba image models","Switch to a provider that implements imageModel (e.g. openai.image(...))"],"exampleFix":"// before\nconst image = await generateImage({ model: alibaba.imageModel('wanx2.1') , prompt });\n// after\nconst image = await generateImage({ model: openai.image('dall-e-3'), prompt });","handlingStrategy":"validation","validationCode":"if (typeof (alibaba as any).imageModel !== 'function' || true) {\n  // alibaba.imageModel always throws; use a provider that supports images\n}","typeGuard":"function supportsImageModel(p: unknown): boolean {\n  try { (p as any).imageModel?.('probe'); return true; } catch { return false; }\n}","tryCatchPattern":"try {\n  model = alibaba.imageModel(modelId);\n} catch (e) {\n  if (NoSuchModelError.isInstance(e) && e.modelType === 'imageModel') {\n    model = otherProvider.image(modelId); // fallback provider\n  } else throw e;\n}","preventionTips":["Check each provider's supported model factory methods (languageModel, embedding, video, imageModel) before use","Consult the @ai-sdk/alibaba README for supported capabilities","Keep a capability map in multi-provider routing code"],"tags":["no-such-model","image-generation","provider-capability"],"backgroundTag":"no-such-model-type","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}