bmad-code-org/BMAD-METHOD · error · Error

${label} does not exist: ${dirPath}

Error message

${label} does not exist: ${dirPath}

What it means

Thrown by assertReadableDir when fs.stat resolves to null, i.e. the directory path does not exist on disk. The helper is an internal precondition check used by InstallPaths.create to validate paths like the BMAD source root before any install work begins.

Source

Thrown at tools/installer/core/install-paths.js:80

  }
  filesManifest() {
    return path.join(this.configDir, 'files-manifest.csv');
  }
  helpCatalog() {
    return path.join(this.configDir, 'bmad-help.csv');
  }
  moduleDir(name) {
    return path.join(this.bmadDir, name);
  }
  moduleConfig(name) {
    return path.join(this.bmadDir, name, 'config.yaml');
  }
}

async function assertReadableDir(dirPath, label) {
  const stat = await fs.stat(dirPath).catch(() => null);
  if (!stat) {
    throw new Error(`${label} does not exist: ${dirPath}`);
  }
  if (!stat.isDirectory()) {
    throw new Error(`${label} is not a directory: ${dirPath}`);
  }
  try {
    await fs.access(dirPath, fs.constants.R_OK);
  } catch {
    throw new Error(`${label} is not readable: ${dirPath}`);
  }
}

async function assertReadableFile(filePath, label) {
  const stat = await fs.stat(filePath).catch(() => null);
  if (!stat) {
    throw new Error(`${label} does not exist: ${filePath}`);
  }
  if (!stat.isFile()) {
    throw new Error(`${label} is not a file: ${filePath}`);

View on GitHub (pinned to b70486b9bd)

Solutions

  1. Verify the BMAD source checkout is intact: `ls <srcDir>` should list package.json and src/.
  2. Reinstall the BMAD package / re-clone the repo so getProjectRoot() resolves to a real directory.
  3. If running from a global install, reinstall it globally.
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('../fs-native');
if (!(await fs.pathExists(dirPath))) {
  throw new Error(`Config error: expected directory missing: ${dirPath}`);
}

Try / catch

try {
  await assertReadableDir(dirPath, label);
} catch (error) {
  if (error.message.endsWith(`does not exist: ${dirPath}`)) {
    // handle missing directory
  }
  throw error;
}

Prevention

When it happens

Trigger: InstallPaths.create() runs assertReadableDir(srcDir, 'BMAD source root') where srcDir = getProjectRoot(); the resolved source root does not exist. Also reachable if a future caller passes a non-existent directory to assertReadableDir.

Common situations: Running the installer from a checkout where the package root was moved/deleted, a broken symlink to the BMAD source, or running against a stale global install whose source tree is gone.

Related errors


AI-assisted analysis of bmad-code-org/BMAD-METHOD@b70486b9bd (2026-08-13). Data as JSON: /api/errors/53e03fe2cbfaf187. Report an issue: GitHub.