CherryHQ/cherry-studio · error · Error
the local embedding model is not fully downloaded
Error message
the local embedding model is not fully downloaded
What it means
Thrown by `currentModelDir()` when `localEmbeddingDownloadService.completeCacheDir()` returns null — i.e. the embedding model files are not fully present on disk. The runtime resolves the cache directory up front (rather than letting transformers.js discover missing files per candidate) so a missing cache fails in the main process with a clear message instead of an opaque worker resolution error.
Source
Thrown at src/main/ai/provider/custom/localEmbedding/localEmbeddingRuntime.ts:15
import { application } from '@application'
import type { EmbeddingModelDir } from '@main/ai/inference/inferenceProtocol'
import { LOCAL_MODELS } from '@main/ai/inference/localModelCatalog'
import { localEmbeddingDownloadService } from '@main/services/localModel'
/**
* The cached model's directory, for loading it straight off disk. Resolving it here — from
* the download service's own on-disk probe — rather than handing the worker a list of mirror
* revisions to try means a missing cache fails in the main process with a clear message,
* instead of surfacing as a transformers.js resolution error per candidate.
*/
export function currentModelDir(): EmbeddingModelDir {
const modelDir = localEmbeddingDownloadService.completeCacheDir()
if (!modelDir) {
throw new Error('the local embedding model is not fully downloaded')
}
return modelDir
}
/**
* Embed texts on the inference worker (off the main thread). Pooling and
* normalization run inside the worker; this is a thin main-process entry point.
* Model files must already be downloaded; inference never fetches missing files.
*/
export async function embedTexts(texts: string[], signal?: AbortSignal): Promise<number[][]> {
if (texts.length === 0) return []
return application
.get('EmbeddingInferenceService')
.embed(texts, currentModelDir(), LOCAL_MODELS.embedding.dtype, signal)
}
View on GitHub (pinned to 726446b54c)
Solutions
- Trigger and await the embedding model download before indexing (use `localEmbeddingDownloadService`).
- Check disk space and re-download if the cache is partial.
- Gate the embedding UI on download completion so requests cannot start early.
Example fix
// before
await embedTexts(texts) // throws if not downloaded
// after
if (!localEmbeddingDownloadService.completeCacheDir()) {
await localEmbeddingDownloadService.ensureDownloaded()
}
await embedTexts(texts) Defensive patterns
Strategy: validation
Validate before calling
if (!localEmbeddingDownloadService.completeCacheDir()) {
throw new Error('Embedding model not downloaded — trigger the download before indexing')
} Type guard
const isEmbeddingModelReady = (): boolean => localEmbeddingDownloadService.completeCacheDir() != null
Prevention
- Gate indexing on download completion in the UI
- Trigger ensureDownloaded() before first embedTexts call
- Re-download if disk space was tight during the first attempt
When it happens
Trigger: Calling `embedTexts` (or otherwise resolving the model dir) before the download finished, or after a partial/interrupted download left the cache incomplete.
Common situations: Knowledge-base indexing started before the model download completed; the download was interrupted (app quit, network drop); disk corruption or manual deletion of cache files; insufficient disk space aborted the download.
Related errors
- Rerank response results must contain numeric index and relev
- local-embedding provider only supports text embeddings, not
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/685d75e5e47292fc.
Report an issue: GitHub.