{"record":{"id":"35351e1c577862de","repo":"eyaltoledano/claude-task-master","slug":"nosuchmodelerror-imagemodel-modelid-modelid","errorCode":null,"errorMessage":"NoSuchModelError (imageModel, modelId: ${modelId})","messagePattern":"NoSuchModelError \\(imageModel, modelId: (.+?)\\)","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/ai-sdk-provider-grok-cli/src/grok-cli-provider.ts","lineNumber":95,"sourceCode":"\t\t\t);\n\t\t}\n\n\t\treturn createModel(modelId, settings);\n\t};\n\n\tprovider.languageModel = createModel;\n\tprovider.chat = createModel; // Alias for languageModel\n\n\t// Add textEmbeddingModel method that throws NoSuchModelError\n\tprovider.textEmbeddingModel = (modelId: string) => {\n\t\tthrow new NoSuchModelError({\n\t\t\tmodelId,\n\t\t\tmodelType: 'textEmbeddingModel'\n\t\t});\n\t};\n\n\tprovider.imageModel = (modelId: string) => {\n\t\tthrow new NoSuchModelError({\n\t\t\tmodelId,\n\t\t\tmodelType: 'imageModel'\n\t\t});\n\t};\n\n\treturn provider as GrokCliProvider;\n}\n\n/**\n * Default Grok CLI provider instance.\n * Pre-configured provider for quick usage without custom settings.\n */\nexport const grokCli = createGrokCli();\n","sourceCodeStart":77,"sourceCodeEnd":109,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/ai-sdk-provider-grok-cli/src/grok-cli-provider.ts#L77-L109","documentation":"The Grok CLI provider does not support image models, so provider.imageModel(modelId) unconditionally throws the AI SDK's NoSuchModelError with modelType 'imageModel'. Any attempt to obtain an image generation model from this provider fails by design.","triggerScenarios":"Calling `grokCli.imageModel('some-model')` or running image-generation AI SDK calls (e.g. experimental_generateImage) with the grok-cli provider.","commonSituations":"Generic provider registries iterating model types; code migrated from a multimodal provider reusing the grok-cli provider for images; feature-flagged image features enabled while only the CLI provider is configured.","solutions":["Configure a vision/image-capable provider for image generation calls.","Gate image features behind a check of provider capabilities before selecting a model.","Keep separate provider instances for chat vs image so image code cannot pick grok-cli.","If the CLI later supports images, upgrade the provider package."],"exampleFix":"// before\nconst model = grokCli.imageModel('grok-image'); // always throws\n// after\nconst model = openai.imageModel('dall-e-3');","handlingStrategy":"type-guard","validationCode":"try { provider.imageModel('probe'); console.log('image supported'); } catch { console.warn('Image generation unsupported by this provider'); }","typeGuard":"function supportsImages(p) { try { p.imageModel('probe'); return true; } catch { return false; } }","tryCatchPattern":"try { const model = provider.imageModel(id); } catch (e) { if (e.name === 'NoSuchModelError' && e.modelType === 'imageModel') { return imageProvider.imageModel(id); } throw e; }","preventionTips":["Route image generation to a provider that implements imageModel","Gate image features on provider capability, not assumptions","Register model types per provider in a central capability map"],"tags":["ai-sdk","image-model","unsupported-operation","grok"],"backgroundTag":"unsupported-model-type","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}