abhigyanpatwari/GitNexus · error

response.message (sidecar init error)

Error message

response.message (sidecar init error)

What it means

After spawning the sidecar, spawnAndInit sends an 'init' message with the persisted embedding config and waits for a 'ready' reply. If the sidecar replies with type 'error', the error message from the sidecar process is re-thrown as an Error here. It means the sidecar process itself failed to initialize its embedding runtime or model.

Solutions

  1. Read the sidecar message — it identifies the init failure (model load, device selection, config validation) and fix that underlying cause.
  2. Clear or correct the persisted embedding config / forceDevice so init uses defaults (CPU, valid model).
  3. Verify the model files exist and are complete; re-download or point embeddingConfig at a valid local model path.
  4. Check GPU drivers/VRAM if a non-CPU device was forced; retry with forceDevice removed.
  5. Increase the init timeout if the model is large and load legitimately exceeds sidecarInitTimeoutMs().

Example fix

// before: forcing a device that may not exist
persistEmbeddingOptions({ forceDevice: 'gpu', embeddingConfig: cfg });
await ensureEmbeddingSidecar();
// after: let the sidecar pick a valid device
persistEmbeddingOptions({ forceDevice: undefined, embeddingConfig: validatedCfg });
await ensureEmbeddingSidecar();
Defensive patterns

Strategy: try-catch

Validate before calling

// validate persisted options before init
const ok = persisted && typeof persisted.embeddingConfig?.model === 'string' &&
  (!persisted.forceDevice || ['cpu', 'gpu'].includes(persisted.forceDevice));
if (!ok) resetPersistedEmbeddingOptions();

Try / catch

try {
  await ensureEmbeddingSidecar();
} catch (e) {
  // sidecar init error: inspect e.message (model/device/config), reset options, retry once
  resetPersistedEmbeddingOptions();
  await ensureEmbeddingSidecar();
}

Prevention

When it happens

Trigger: ensureEmbeddingSidecar() → spawnAndInit() sends {type:'init', embeddingConfig, forceDevice}; the sidecar responds {type:'error', message} within sidecarInitTimeoutMs(); the message is thrown verbatim.

Common situations: Invalid or unsupported embedding model name/path in the persisted config; forceDevice naming a GPU that does not exist or lacks drivers; model download failure; corrupt model files; out-of-memory during model load.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@ac9a4e9abd (2026-09-15). Data as JSON: /api/errors/56d0676d95a2dedc. Report an issue: GitHub.

Appendix: source

Thrown at gitnexus/src/core/embeddings/embedding-sidecar-client.ts:333

  const persisted = {
    embeddingConfig: options?.embeddingConfig ?? lastInitOptions?.embeddingConfig,
    forceDevice: options?.forceDevice ?? lastInitOptions?.forceDevice,
  };

  child = spawnSidecar();
  attachChild(child);
  progressSink = options?.onProgress;
  try {
    const response = await request(
      {
        type: 'init',
        embeddingConfig: persisted.embeddingConfig,
        forceDevice: persisted.forceDevice,
      },
      sidecarInitTimeoutMs(),
    );
    if (response.type === 'error') throw new Error(response.message);
    if (response.type !== 'ready') {
      throw new Error(`Unexpected sidecar response: ${response.type}`);
    }
    ready = true;
    device = response.device;
    lastInitOptions = persisted;
  } catch (err) {
    reapEmbeddingSidecar();
    throw err;
  } finally {
    progressSink = undefined;
  }
};

const rejectConflictingForceDevice = (forceDevice?: EmbeddingSidecarDevice): void => {
  if (forceDevice && forceDevice !== device) {
    throw new Error(
      `Embedding sidecar already initialized on ${device}; cannot switch to ${forceDevice}`,

View on GitHub (pinned to ac9a4e9abd)