magic-context icon indicating copy to clipboard operation
magic-context copied to clipboard

Fix missing embedding model manually

Open yiding-he opened this issue 5 months ago • 1 comments

Short description

need a way to re-run downloading embedding model

What problem does this solve?

When embedding model failed to download for the first time run, it keeps show logs below:

[magic-context] embedding model failed to load: {"name":"ResolveMessage",
"position":null,"message":"Cannot find package 'onnxruntime-node' from 'C
:\\Users\\qufei\\.cache\\opencode\\packages\\@cortexkit\\opencode-magic-c
ontext@latest\\node_modules\\@huggingface\\transformers\\dist\\transforme
rs.node.mjs'","level":"error","specifier":"onnxruntime-node","importKind"
:"import-statement","referrer":"C:\\Users\\qufei\\.cache\\opencode\\packa
ges\\@cortexkit\\opencode-magic-context@latest\\node_modules\\@huggingfac
e\\transformers\\dist\\transformers.node.mjs"}
Image

Proposed solution

Provide a slash command or a button in desktop app for re-running downloading embedding model.

Alternatives considered

No response

Area

Memory / historian / dreamer

Additional context

No response

yiding-he avatar Jun 05 '26 01:06 yiding-he

Thanks for the detail. Worth clarifying what's actually happening, because it's not the embedding model — it's the embedding runtime.

Magic Context's local embeddings run through @huggingface/transformers, which does a static import "onnxruntime-node" (a native package with a platform-specific binary). On your install that package — or its Windows binary — didn't install correctly, so the import throws Cannot find package 'onnxruntime-node' on every embedding attempt. Re-downloading the model wouldn't help; the model file isn't the missing piece.

Two things are landing in the next release:

  1. Graceful degradation — Magic Context now detects this specific failure and disables local embeddings with a single clear, actionable log line instead of repeating the cryptic resolver error on every attempt. Your existing memories are untouched.
  2. Doctor detection — doctor now inspects the installed plugin for onnxruntime-node (and its platform binary) and flags it up front with the fix, rather than letting you discover it in the logs.

Until that release, you can fix it by:

  • reinstalling the plugin: npx @cortexkit/magic-context@latest doctor --force, or
  • setting embedding.provider to openai-compatible (LM Studio / Ollama) or off.

I'll follow up here when the release with the doctor check ships.

alfonso-magic-context avatar Jun 14 '26 16:06 alfonso-magic-context

Shipped in v0.25.0 — following up as promised.

Both pieces landed:

  1. Graceful degradation — Magic Context now detects the missing local embedding runtime (onnxruntime-node) and disables local embeddings with a single clear log line instead of repeating the resolver error on every attempt. Existing memories are untouched.
  2. Doctor detection — doctor now checks the installed plugin for the embedding runtime (layout-agnostic resolution) and flags it up front with the fix.

Update with npx @cortexkit/magic-context@latest doctor --force. Reopen if the doctor check doesn't catch your case.

alfonso-magic-context avatar Jun 17 '26 12:06 alfonso-magic-context