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

${label} is not writable: ${dirPath}

Error message

${label} is not writable: ${dirPath}

What it means

Thrown by ensureWritableDir after the directory exists (or was just created) but fs.access with R_OK|W_OK fails — the process cannot write to it. Catches the case where the directory is present yet not writable by the current user.

Source

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

    throw new Error(`${label} exists but is not a directory: ${dirPath}`);
  }

  try {
    await fs.ensureDir(dirPath);
  } catch (error) {
    if (error.code === 'EACCES') {
      throw new Error(`${label}: permission denied creating directory: ${dirPath}`);
    }
    if (error.code === 'ENOSPC') {
      throw new Error(`${label}: no space left on device: ${dirPath}`);
    }
    throw new Error(`${label}: cannot create directory: ${dirPath} (${error.message})`);
  }

  try {
    await fs.access(dirPath, fs.constants.R_OK | fs.constants.W_OK);
  } catch {
    throw new Error(`${label} is not writable: ${dirPath}`);
  }
}

module.exports = { InstallPaths };

View on GitHub (pinned to b70486b9bd)

Solutions

  1. Take ownership / grant write: `chown` or `chmod +w <dirPath>`.
  2. Choose a target the current user fully owns.
  3. If read-only mount, remount read-write or relocate the target.
Defensive patterns

Strategy: validation

Validate before calling

await fs.access(dirPath, fs.constants.R_OK | fs.constants.W_OK);

Try / catch

try {
  await ensureWritableDir(dirPath, label);
} catch (error) {
  if (error.message.includes('is not writable')) { /* fix ownership/perms */ }
  throw error;
}

Prevention

When it happens

Trigger: InstallPaths.create() successfully resolves/creates the project root or a _bmad subdirectory, but the final R_OK|W_OK access check fails (e.g. directory owned by another user, read-only mount).

Common situations: Directory created by root but installer runs as a normal user, a read-only filesystem mount, ACLs denying write, or a parent that allows mkdir but not subsequent writes.

Related errors


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