{"record":{"id":"ebcae030d574919c","repo":"Mintplex-Labs/anything-llm","slug":"efi-vars-template-not-found-file-searched-in","errorCode":null,"errorMessage":"EFI vars template not found: ${file}\nSearched in: ${QEMU_DIST || '(no QEMU_DIST set)'}\nSet OPEN_COMPUTER_QEMU_DIR to your QEMU installation directory.","messagePattern":"EFI vars template not found: (.+?)\nSearched in: (.+?)\nSet OPEN_COMPUTER_QEMU_DIR to your QEMU installation directory\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"open-computer/cli/src/config.ts","lineNumber":108,"sourceCode":"// not the CODE firmware: copying CODE into the vars slot leaves OVMF without a\n// variable store, so it never POSTs and the display stays blank.\nexport function efiVarsFileName(guestArch: 'aarch64' | 'x86_64' = GUEST_ARCH): string {\n  return guestArch === 'x86_64' ? 'edk2-i386-vars.fd' : 'edk2-arm-vars.fd';\n}\n\nexport function resolveEfiVars(): string {\n  const file = efiVarsFileName();\n  if (QEMU_DIST) {\n    // The bundled Windows build ships the vars template in share/ (not share/qemu/).\n    for (const cand of [\n      path.join(QEMU_DIST, 'share', 'qemu', file),\n      path.join(QEMU_DIST, 'share', file),\n    ]) {\n      if (fs.existsSync(cand)) return cand;\n    }\n  }\n  if (PLATFORM === 'win32') {\n    throw new Error(\n      `EFI vars template not found: ${file}\\n` +\n      `Searched in: ${QEMU_DIST || '(no QEMU_DIST set)'}\\n` +\n      `Set OPEN_COMPUTER_QEMU_DIR to your QEMU installation directory.`,\n    );\n  }\n  const shareDir = PLATFORM === 'linux' ? '/usr/share/qemu' : '/opt/homebrew/share/qemu';\n  return `${shareDir}/${file}`;\n}\n\n// Full path to the qemu-img binary\nexport function resolveQemuImgBinary(): string {\n  const binaryName = PLATFORM === 'win32' ? 'qemu-img.exe' : 'qemu-img';\n  if (QEMU_DIST) {\n    const bundled = path.join(QEMU_DIST, 'bin', binaryName);\n    if (fs.existsSync(bundled)) return bundled;\n    const direct = path.join(QEMU_DIST, binaryName);\n    if (fs.existsSync(direct)) return direct;\n  }","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/open-computer/cli/src/config.ts#L90-L126","documentation":"Thrown by resolveEfiVars() in the open-computer CLI when, on Windows only, the writable EFI variable-store template (edk2-i386-vars.fd for x86_64 guests, edk2-arm-vars.fd for aarch64) is missing from both ${QEMU_DIST}/share/qemu/ and ${QEMU_DIST}/share/. The vars template is copied per-VM as the writable pflash; per the code comment, using the CODE image in the vars slot leaves OVMF without a variable store so the guest never POSTs. The bundled Windows QEMU build ships this file in share/ rather than share/qemu/, hence the two search locations.","triggerScenarios":"Same conditions as the EFI code error but for the vars file: OPEN_COMPUTER_QEMU_DIR or the bundled master/qemu/win-* folder exists (so resolveEfiCode may pass) yet edk2-i386-vars.fd / edk2-arm-vars.fd is absent from share/ and share/qemu/; typically a trimmed QEMU distribution that ships edk2-*-code.fd but not the vars template.","commonSituations":"Hand-assembled QEMU folder where only the *-code.fd was copied; a QEMU package that splits OVMF vars into a separate firmware package; moving files after first successful boot and losing the template.","solutions":["Copy edk2-i386-vars.fd (x86_64 host) or edk2-arm-vars.fd (arm64 host) into ${QEMU_DIST}/share/ (bundled layout) or ${QEMU_DIST}/share/qemu/","Set OPEN_COMPUTER_QEMU_DIR to a complete QEMU installation that ships both code and vars EDK2 files","Re-download/re-extract the bundled QEMU archive so the full share/ tree is restored","If only an edk2-*-vars.fd from another distro is available, use one matching the same EDK2 build as your code image to avoid pflash format mismatch"],"exampleFix":"# before: C:\\qemu\\share\\qemu\\ has edk2-x86_64-code.fd but no vars file -> throw\n# after: place the vars template where the resolver looks\n cp /usr/share/edk2/ovmf-vars.fd  $OPEN_COMPUTER_QEMU_DIR/share/edk2-i386-vars.fd\n# (any blank OVMF/EDK2 vars store works as the template)","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction efiVarsExists(qemuDir, arch) {\n  const file = arch === 'x86_64' ? 'edk2-i386-vars.fd' : 'edk2-arm-vars.fd';\n  return [path.join(qemuDir, 'share', 'qemu', file), path.join(qemuDir, 'share', file)]\n    .some((p) => fs.existsSync(p));\n}","typeGuard":null,"tryCatchPattern":"try { vm.start({ efiVars: resolveEfiVars() }); } catch (e) { if (/EFI vars template not found/.test(e.message)) { /* copy the vars .fd into ${QEMU_DIST}/share and restart */ } else throw e; }","preventionTips":["When assembling a QEMU folder manually, copy BOTH edk2 code and vars .fd files — code alone boots nothing","Never point the vars slot at the code image (the source comment warns the guest will never POST)","Include an edk2/ovmf firmware check in your setup smoke test next to the qemu binary check"],"tags":["qemu","efi","edk2","firmware","windows","pflash","open-computer"],"backgroundTag":"missing-firmware-file","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}