bmad-code-org/BMAD-METHOD · error · Error
${label} does not exist: ${filePath}
Error message
${label} does not exist: ${filePath} What it means
Thrown by assertReadableFile when fs.stat resolves to null — the expected file does not exist. Used to validate required files such as package.json (label 'package.json') inside the BMAD source root before reading them.
Source
Thrown at tools/installer/core/install-paths.js:95
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}`);
}
try {
await fs.access(filePath, fs.constants.R_OK);
} catch {
throw new Error(`${label} is not readable: ${filePath}`);
}
}
async function ensureWritableDir(dirPath, label) {
const stat = await fs.stat(dirPath).catch(() => null);
if (stat && !stat.isDirectory()) {
throw new Error(`${label} exists but is not a directory: ${dirPath}`);
}
try {View on GitHub (pinned to b70486b9bd)
Solutions
- Confirm the file exists: `ls <filePath>`.
- Re-clone or reinstall the BMAD package so required files are present.
- If you control getProjectRoot(), ensure it points at the directory containing package.json.
Defensive patterns
Strategy: validation
Validate before calling
if (!(await fs.pathExists(filePath))) {
throw new Error(`Missing required file: ${filePath}`);
} Try / catch
try {
await assertReadableFile(filePath, label);
} catch (error) {
if (error.message.endsWith(`does not exist: ${filePath}`)) { /* missing file */ }
throw error;
} Prevention
- Ship package.json and other required files in every package build.
- Validate the source tree integrity before running install.
When it happens
Trigger: InstallPaths.create() calls assertReadableFile(pkgPath, 'package.json') and the resolved source root has no package.json. Reachable for any caller validating a required readable file.
Common situations: Corrupted or partial checkout missing package.json, running from a directory that is not a real BMAD source tree, or a packaging defect that omitted package.json.
Related errors
- ${label} does not exist: ${dirPath}
- ${label} is not a directory: ${dirPath}
- ${label} is not readable: ${dirPath}
- ${label} is not a file: ${filePath}
- ${label} is not readable: ${filePath}
AI-assisted analysis of bmad-code-org/BMAD-METHOD@b70486b9bd (2026-08-13).
Data as JSON: /api/errors/03ff76f331d6bb22.
Report an issue: GitHub.