Skip to content

[OMP] Local embeddings fail: cannot register backend "cpu" using priority 10 #441

Description

@sisttri

Short description

MC then reports the embedding provider as unavailable

What happened?

Magic Context diagnostic CLI: 0.42.3
Installed plugin: @cortexkit/pi-magic-context 0.41.4
OMP: 18.1.19

PASS: Plugin is enabled and exposes an OMP/Pi extension manifest.
PASS: Magic Context config parses and runtime config loads successfully.
PASS: SQLite integrity_check: ok.

Local paths and unrelated configuration details omitted for privacy.

Problem

Local embedding initialization fails in OMP with: cannot register backend "cpu" using priority 10,MC then reports the embedding provider as unavailable.

Environment

  • OMP: 18.1.19
  • @cortexkit/pi-magic-context: 0.41.4
  • Bun: 1.3.14
  • Platform: macOS arm64
  • embedding.local_runtime: default (auto, selects WASM)
{
  "embedding": {
    "provider": "local",
    "model": "Xenova/paraphrase-multilingual-MiniLM-L12-v2",
    "local_dtype": "q8"
  }
}

Reproduction

  1. Start OMP with MC and the configuration above.
  2. Trigger a memory embedding operation.
  3. Observe the backend registration error in the MC log.

An isolated diagnostic also reproduced the failure by calling MC's actual loadTransformersForLocalEmbedding("auto") through OMP's
loadLegacyPiModule. Calling the same function through a normal import succeeds.

Findings

The trace shows the same ONNX entry loaded under two module identities:

onnxruntime-web/dist/ort.node.min.mjs?mtime=<reload-tag>
onnxruntime-web/dist/ort.node.min.mjs

OMP adds the reload tag to MC's literal import("onnxruntime-web"). MC later loads transformers-node-wasm.js through a computed URL, which imports the query-free ONNX entry.

Both instances use the same backend registry. The second CPU backend registration fails.

Candidate fix

In a temporary MC copy, changing:

module: await import("onnxruntime-web"),

to:

module: await import(import.meta.resolve("onnxruntime-web")),

resolved the initialization failure.

Verification without tracing hooks:

  • Original code: fails.
  • Candidate fix: succeeds through two successive same-process loader calls.
  • Reverted change: fails again.

Diagnostics

## Description
MC then reports the embedding provider as unavailable.

## OMP diagnostics
- Magic Context CLI: 0.42.3
- PASS: OMP 18.1.19 detected at ~/.bun/bin/omp
- PASS: @cortexkit/pi-magic-context 0.41.4 is enabled
- PASS: Plugin exposes an OMP/Pi extension manifest
- PASS: OMP native compaction is disabled
- PASS: OMP automatic memory backend is disabled
- PASS: OMP agent directory resolved to ~/.omp/agent
- PASS: Magic Context config parses: ~/.config/cortexkit/magic-context.jsonc
- PASS: Magic Context runtime config loads successfully
- INFO: Shared storage: ~/.local/share/cortexkit/magic-context (source: platform default)
- PASS: SQLite integrity_check: ok
- INFO: OMP config: ~/.omp/agent/config.yml
- INFO: OMP plugin lock: ~/.omp/plugins/omp-plugins.lock.json
- INFO: OMP sessions: ~/.omp/agent/sessions
- INFO: OMP runtime log read: /var/folders/jp/kz8h2_sj6gd134_s6cngq07c6tbx20/T/omp/magic-context/magic-context.log (grammar=legacy, lines=11556, 1630 KB)

Plugin version

@cortexkit/pi-magic-context 0.41.4

OpenCode version

Platform

macOS arm64

Client

omp/18.1.19

Log output (optional)

[magic-context] embedding model failed to load (local_runtime_error: the local embedding runtime failed: cannot register backend "cpu" using
priority 10): cannot register backend "cpu" using priority 10
Error: cannot register backend "cpu" using priority 10
    at registerBackend (<plugin-node_modules>/onnxruntime-web/node_modules/onnxruntime-common/dist/esm/backend-impl.js:27:27)
    at <plugin-node_modules>/onnxruntime-web/dist/ort.node.min.mjs:7:27286
    at processTicksAndRejections (native:7:39)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions