eyaltoledano/claude-task-master · error · NoSuchModelError
NoSuchModelError (textEmbeddingModel, modelId: ${modelId})
Error message
NoSuchModelError (textEmbeddingModel, modelId: ${modelId}) What it means
The Grok CLI provider does not support embedding models, so provider.textEmbeddingModel(modelId) unconditionally throws the AI SDK's NoSuchModelError with modelType 'textEmbeddingModel'. Calling it always fails, regardless of the modelId passed.
Source
Thrown at packages/ai-sdk-provider-grok-cli/src/grok-cli-provider.ts:88
const provider = function (
modelId: GrokCliModelId,
settings?: GrokCliSettings
) {
if (new.target) {
throw new Error(
'The Grok CLI model function cannot be called with the new keyword.'
);
}
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.View on GitHub (pinned to c0c98d367c)
Solutions
- Use a different provider that implements embeddings (e.g. OpenAI) for embedding calls.
- Add a capability check/guard so embedding-dependent code paths never select the grok-cli provider.
- Refactor to inject a dedicated embedding provider alongside the grok-cli chat provider.
- If embeddings are genuinely needed from Grok, file/await upstream support rather than working around this error.
Example fix
// before
const { embedding } = await embed({ model: grokCli.textEmbeddingModel('x') , value });
// after
const { embedding } = await embed({ model: openai.textEmbeddingModel('text-embedding-3-small'), value }); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof provider.textEmbeddingModel === 'function') { try { provider.textEmbeddingModel('probe'); } catch { console.warn('Embeddings unsupported by this provider'); } } Type guard
function supportsEmbeddings(p) { const probe = (() => { try { p.textEmbeddingModel('probe'); return true; } catch { return false; } })(); return probe; } Try / catch
try { const model = provider.textEmbeddingModel(id); } catch (e) { if (e.name === 'NoSuchModelError' && e.modelType === 'textEmbeddingModel') { return embeddingFallbackProvider.textEmbeddingModel(id); } throw e; } Prevention
- Keep a separate dedicated embedding provider in your model registry
- Capability-check providers before routing embedding workloads to them
- Document grok-cli as chat-only in team docs
When it happens
Trigger: Calling `grokCli.textEmbeddingModel('some-model')` or passing the provider where the AI SDK framework requests a text embedding model (e.g. embed(), embedMany()).
Common situations: Reusing a shared provider registry that assumes every provider exposes embeddings; adding RAG/embedding code to a codebase that uses the Grok CLI provider; generic model factory code selecting textEmbeddingModel.
Related errors
- NoSuchModelError (imageModel, 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/0ebba4c372dbe491.
Report an issue: GitHub.