{"record":{"id":"0ebba4c372dbe491","repo":"eyaltoledano/claude-task-master","slug":"nosuchmodelerror-textembeddingmodel-modelid-m","errorCode":null,"errorMessage":"NoSuchModelError (textEmbeddingModel, modelId: ${modelId})","messagePattern":"NoSuchModelError \\(textEmbeddingModel, modelId: (.+?)\\)","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/ai-sdk-provider-grok-cli/src/grok-cli-provider.ts","lineNumber":88,"sourceCode":"\tconst provider = function (\n\t\tmodelId: GrokCliModelId,\n\t\tsettings?: GrokCliSettings\n\t) {\n\t\tif (new.target) {\n\t\t\tthrow new Error(\n\t\t\t\t'The Grok CLI model function cannot be called with the new keyword.'\n\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.","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/ai-sdk-provider-grok-cli/src/grok-cli-provider.ts#L70-L106","documentation":"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.","triggerScenarios":"Calling `grokCli.textEmbeddingModel('some-model')` or passing the provider where the AI SDK framework requests a text embedding model (e.g. embed(), embedMany()).","commonSituations":"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.","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."],"exampleFix":"// before\nconst { embedding } = await embed({ model: grokCli.textEmbeddingModel('x') , value });\n// after\nconst { embedding } = await embed({ model: openai.textEmbeddingModel('text-embedding-3-small'), value });","handlingStrategy":"type-guard","validationCode":"if (typeof provider.textEmbeddingModel === 'function') { try { provider.textEmbeddingModel('probe'); } catch { console.warn('Embeddings unsupported by this provider'); } }","typeGuard":"function supportsEmbeddings(p) { const probe = (() => { try { p.textEmbeddingModel('probe'); return true; } catch { return false; } })(); return probe; }","tryCatchPattern":"try { const model = provider.textEmbeddingModel(id); } catch (e) { if (e.name === 'NoSuchModelError' && e.modelType === 'textEmbeddingModel') { return embeddingFallbackProvider.textEmbeddingModel(id); } throw e; }","preventionTips":["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"],"tags":["ai-sdk","embeddings","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"}