Mintplex-Labs/anything-llm · error · Error

QEMU directory not found: ${dir}\nContents of ${parent}: ${c

Error message

QEMU directory not found: ${dir}\nContents of ${parent}: ${contents}\nMake sure the QEMU archive is extracted so that the folder is named "${variant}" (not "qemu-${variant}" or a nested subfolder). You can also set OPEN_COMPUTER_QEMU_DIR to point to your QEMU installation.

What it means

Thrown by defaultQemuDir() in the open-computer CLI (config.ts) on Windows: the expected QEMU install directory <OPEN_COMPUTER_DIR>/master/qemu/win-x64|win-arm64 does not exist. The message is self-diagnosing — it prints the computed path, the parent directory's actual contents, and both supported remedies (name the extracted folder correctly, or point OPEN_COMPUTER_QEMU_DIR elsewhere). macOS builds a different path and Linux assumes system QEMU, so only Windows hits this.

Source

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

// On Windows x64      the guest is x86_64  (WHPX + amd64 Debian).
// On Windows arm64    the guest is aarch64 (WHPX + ARM64 Debian).
export const GUEST_ARCH: 'aarch64' | 'x86_64' = ARCH === 'x64' ? 'x86_64' : 'aarch64';

export const QEMU_BINARY =
  GUEST_ARCH === 'aarch64' ? 'qemu-system-aarch64' : 'qemu-system-x86_64';

function defaultQemuDir(): string {
  if (PLATFORM === 'darwin') {
    const darwinVariant = ARCH === 'x64' ? 'darwin-x64' : 'darwin-arm64';
    return path.join(OPEN_COMPUTER_DIR, 'master', 'qemu', darwinVariant);
  }
  if (PLATFORM === 'win32') {
    const variant = ARCH === 'x64' ? 'win-x64' : 'win-arm64';
    const dir = path.join(OPEN_COMPUTER_DIR, 'master', 'qemu', variant);
    if (!fs.existsSync(dir)) {
      const parent = path.join(OPEN_COMPUTER_DIR, 'master', 'qemu');
      const contents = fs.existsSync(parent) ? fs.readdirSync(parent).join(', ') : '(directory missing)';
      throw new Error(
        `QEMU directory not found: ${dir}\n` +
        `Contents of ${parent}: ${contents}\n` +
        `Make sure the QEMU archive is extracted so that the folder is named "${variant}" ` +
        `(not "qemu-${variant}" or a nested subfolder). ` +
        `You can also set OPEN_COMPUTER_QEMU_DIR to point to your QEMU installation.`
      );
    }
    return dir;
  }
  // Linux: assume system QEMU
  return '';
}

export const QEMU_DIST = process.env.OPEN_COMPUTER_QEMU_DIR ?? defaultQemuDir();

// Full path to the QEMU binary (with .exe on Windows)
export function resolveQemuBinary(): string {
  const binaryName = PLATFORM === 'win32' ? `${QEMU_BINARY}.exe` : QEMU_BINARY;

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Rename/move the extracted folder so the path is exactly <OPEN_COMPUTER_DIR>/master/qemu/win-x64 (or win-arm64).
  2. If extraction duplicated the folder, move the inner contents up one level so there is no nesting.
  3. Alternatively set OPEN_COMPUTER_QEMU_DIR to wherever QEMU actually lives and retry.
  4. Use the parent-directory listing printed in the message to see the exact name the folder got.

Example fix

# before — archive extracted with its default name
master/qemu/qemu-win-x64/qemu-system-x86_64.exe

# after — rename so the variant is the folder name
mv master/qemu/qemu-win-x64 master/qemu/win-x64
# or: export OPEN_COMPUTER_QEMU_DIR=/c/tools/qemu-win-x64
Defensive patterns

Strategy: validation

Validate before calling

// run before any code path that calls defaultQemuDir()
import fs from 'node:fs';
import path from 'node:path';

function resolveQemuDir(override?: string): string | null {
  const variant = process.arch === 'x64' ? 'win-x64' : 'win-arm64';
  const dir = override ?? path.join(OPEN_COMPUTER_DIR, 'master', 'qemu', variant);
  return fs.existsSync(dir) ? dir : null;
}

const qemuDir = resolveQemuDir(process.env.OPEN_COMPUTER_QEMU_DIR);
if (!qemuDir) {
  console.error('Set OPEN_COMPUTER_QEMU_DIR or extract QEMU to master/qemu/<variant>');
  process.exit(1);
}

Type guard

function isReadyQemuDir(dir: string | null | undefined): dir is string {
  if (!dir) return false;
  try {
    return fs.statSync(dir).isDirectory();
  } catch {
    return false;
  }
}

Try / catch

try {
  const qemuDir = defaultQemuDir();
} catch (e) {
  // message already prints the expected path, the parent listing, and both fixes
  console.error(e instanceof Error ? e.message : e);
  process.exit(1);
}

Prevention

When it happens

Trigger: Running the CLI on Windows after downloading the QEMU archive but extracting it with its default top-level name (qemu-win-x64 instead of win-x64), leaving it nested one level deeper (win-x64/win-x64), or never extracting it at all — the fs.existsSync check fails and the error includes the parent listing showing what actually landed there.

Common situations: Archive extracted with the wrapper folder name intact; a second extraction nesting the folder; the master/qemu tree moved after a first successful run; ARM machine where win-arm64 was downloaded but a win-x64 folder was created manually.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/6ffe1b71983eb7b9. Report an issue: GitHub.