Mintplex-Labs/anything-llm · critical · Error

EFI vars template not found: ${file} Searched in: ${QEMU_DIS

Error message

EFI vars template not found: ${file}
Searched in: ${QEMU_DIST || '(no QEMU_DIST set)'}
Set OPEN_COMPUTER_QEMU_DIR to your QEMU installation directory.

What it means

Thrown only on Windows by resolveEfiVars() when the EDK2 'vars' template file (edk2-i386-vars.fd for x86_64, edk2-arm-vars.fd for aarch64) is not found in either <QEMU_DIST>/share/qemu/ or <QEMU_DIST>/share/. This file is copied to become the writable pflash variable store; the code comment explicitly warns that substituting the CODE firmware here breaks UEFI (no variable store → no POST).

Source

Thrown at open-computer/cli/src/config.ts:108

// not the CODE firmware: copying CODE into the vars slot leaves OVMF without a
// variable store, so it never POSTs and the display stays blank.
export function efiVarsFileName(guestArch: 'aarch64' | 'x86_64' = GUEST_ARCH): string {
  return guestArch === 'x86_64' ? 'edk2-i386-vars.fd' : 'edk2-arm-vars.fd';
}

export function resolveEfiVars(): string {
  const file = efiVarsFileName();
  if (QEMU_DIST) {
    // The bundled Windows build ships the vars template in share/ (not share/qemu/).
    for (const cand of [
      path.join(QEMU_DIST, 'share', 'qemu', file),
      path.join(QEMU_DIST, 'share', file),
    ]) {
      if (fs.existsSync(cand)) return cand;
    }
  }
  if (PLATFORM === 'win32') {
    throw new Error(
      `EFI vars template not found: ${file}\n` +
      `Searched in: ${QEMU_DIST || '(no QEMU_DIST set)'}\n` +
      `Set OPEN_COMPUTER_QEMU_DIR to your QEMU installation directory.`,
    );
  }
  const shareDir = PLATFORM === 'linux' ? '/usr/share/qemu' : '/opt/homebrew/share/qemu';
  return `${shareDir}/${file}`;
}

// Full path to the qemu-img binary
export function resolveQemuImgBinary(): string {
  const binaryName = PLATFORM === 'win32' ? 'qemu-img.exe' : 'qemu-img';
  if (QEMU_DIST) {
    const bundled = path.join(QEMU_DIST, 'bin', binaryName);
    if (fs.existsSync(bundled)) return bundled;
    const direct = path.join(QEMU_DIST, binaryName);
    if (fs.existsSync(direct)) return direct;
  }

View on GitHub (pinned to 526360e320)

Solutions

  1. Obtain the matching VARS template (edk2-i386-vars.fd or edk2-arm-vars.fd) and place it in <QEMU_DIST>/share/qemu/.
  2. Do NOT substitute the CODE firmware as a vars file — that produces a blank-display POST failure.
  3. Use a complete QEMU+EDK2 distribution by setting OPEN_COMPUTER_QEMU_DIR correctly.
  4. Verify guestArch aligns with the vars filename (i386-vars for x86_64, arm-vars for aarch64).
Defensive patterns

Strategy: validation

Validate before calling

// Verify the EDK2 vars template exists before launching.
const fs = require('fs'), path = require('path');
function efiVarsPresent(qemuDist, file) {
  return fs.existsSync(path.join(qemuDist, 'share', 'qemu', file))
      || fs.existsSync(path.join(qemuDist, 'share', file));
}

Try / catch

try {
  launchVm(resolveEfiVars());
} catch (e) {
  if (/EFI vars template not found/.test(e.message)) {
    console.error('Install EDK2 vars template — do NOT substitute the code firmware.');
    process.exit(2);
  }
  throw e;
}

Prevention

When it happens

Trigger: The QEMU distribution ships the CODE firmware but not the VARS template (common with minimal builds), the VARS file was renamed, or QEMU_DIST is misconfigured.

Common situations: User copied edk2-x86_64-code.fd into the vars slot to 'fix' a missing-vars error and now the VM hangs at POST with a blank display; QEMU build only packaged the code firmware; aarch64 install missing edk2-arm-vars.fd.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/ebcae030d574919c. Report an issue: GitHub.