CherryHQ/cherry-studio · error · Error
local-embedding provider only supports text embeddings, not
Error message
local-embedding provider only supports text embeddings, not ${capability} What it means
Thrown by the local-embedding provider when `languageModel` or `imageModel` is called. This provider is embedding-only by design — it exists solely to serve the knowledge base's local text embeddings via transformers.js. The `unsupported` helper throws immediately to make the capability boundary explicit rather than returning a model that would fail later.
Source
Thrown at src/main/ai/provider/custom/localEmbedding/localEmbeddingProvider.ts:53
/**
* Unused in-process (no HTTP), but the shared provider config builder does
* `config.providerSettings.fetch ??= customFetch` across the settings union,
* so every member must carry this field. See `provider/config.ts`.
*/
fetch?: FetchFunction
}
/**
* Embedding-only `ProviderV3`. Language / image models throw, since this
* provider exists solely to serve the knowledge base's local text embeddings.
*/
// `_settings` is unused (in-process provider, no config) but its type is how the
// extension registry infers this provider's settings type — keep the parameter.
// oxlint-disable-next-line no-unused-vars
export function createLocalEmbeddingProvider(_settings: LocalEmbeddingProviderSettings = {}): ProviderV3 {
const embeddingModel = (modelId: string): EmbeddingModelV3 => new LocalEmbeddingModel(modelId)
const unsupported = (capability: string) => (): never => {
throw new Error(`local-embedding provider only supports text embeddings, not ${capability}`)
}
return {
specificationVersion: 'v3',
embeddingModel,
textEmbeddingModel: embeddingModel,
languageModel: unsupported('language models') as (modelId: string) => LanguageModelV3,
imageModel: unsupported('image models') as (modelId: string) => ImageModelV3
}
}
View on GitHub (pinned to 726446b54c)
Solutions
- Use the local-embedding provider only for text embeddings (`embeddingModel` / `textEmbeddingModel`).
- Route chat and image requests to a provider that supports them (OpenAI, DashScope, etc.).
- Fix the model/provider mapping that misrouted a non-embedding call here.
Example fix
// before
const model = localProvider.languageModel('bge-m3') // throws
// after
const model = localProvider.textEmbeddingModel('bge-m3') Defensive patterns
Strategy: type-guard
Validate before calling
if (providerId === LOCAL_EMBEDDING_PROVIDER_ID && capability !== 'embedding') {
throw new Error(`local-embedding only supports embeddings — route ${capability} elsewhere`)
} Type guard
const supportsCapability = (providerId: string, capability: 'embedding' | 'language' | 'image'): boolean => providerId !== LOCAL_EMBEDDING_PROVIDER_ID || capability === 'embedding'
Prevention
- Keep the local-embedding provider out of chat/image routing tables
- Tag local-embedding models as embedding-only in the model registry
- Test that misrouting throws a clear message
When it happens
Trigger: Calling `provider.languageModel(id)` or `provider.imageModel(id)` on a provider created by `createLocalEmbeddingProvider`; or a model-routing layer dispatching a chat/image request to the local-embedding provider id.
Common situations: A model was tagged with the local-embedding provider id in config but referenced for chat/image; a routing table fell back to the wrong provider; a test reused the local provider for a non-embedding call.
Related errors
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/7a8860efe96aaacf.
Report an issue: GitHub.