eyaltoledano/claude-task-master · error · NoSuchModelError
NoSuchModelError (imageModel, modelId: ${modelId})
Error message
NoSuchModelError (imageModel, modelId: ${modelId}) What it means
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.
Source
Thrown at packages/ai-sdk-provider-grok-cli/src/grok-cli-provider.ts:95
);
}
return createModel(modelId, settings);
};
provider.languageModel = createModel;
provider.chat = createModel; // Alias for languageModel
// Add textEmbeddingModel method that throws NoSuchModelError
provider.textEmbeddingModel = (modelId: string) => {
throw new NoSuchModelError({
modelId,
modelType: 'textEmbeddingModel'
});
};
provider.imageModel = (modelId: string) => {
throw new NoSuchModelError({
modelId,
modelType: 'imageModel'
});
};
return provider as GrokCliProvider;
}
/**
* Default Grok CLI provider instance.
* Pre-configured provider for quick usage without custom settings.
*/
export const grokCli = createGrokCli();
View on GitHub (pinned to c0c98d367c)
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.
Example fix
// before
const model = grokCli.imageModel('grok-image'); // always throws
// after
const model = openai.imageModel('dall-e-3'); Defensive patterns
Strategy: type-guard
Validate before calling
try { provider.imageModel('probe'); console.log('image supported'); } catch { console.warn('Image generation unsupported by this provider'); } Type guard
function supportsImages(p) { try { p.imageModel('probe'); return true; } catch { return false; } } Try / catch
try { const model = provider.imageModel(id); } catch (e) { if (e.name === 'NoSuchModelError' && e.modelType === 'imageModel') { return imageProvider.imageModel(id); } throw e; } Prevention
- 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
When it happens
Trigger: Calling `grokCli.imageModel('some-model')` or running image-generation AI SDK calls (e.g. experimental_generateImage) with the grok-cli provider.
Common situations: 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.
Related errors
- NoSuchModelError (textEmbeddingModel, modelId: ${modelId})
- NoSuchModelError (languageModel, modelId: ${modelId})
- MCP provider requires session object
- The MCP model function cannot be called with the new keyword
- MCP session must have client sampling capabilities
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/35351e1c577862de.
Report an issue: GitHub.