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

Shared scripts source directory not found: ${srcScriptsDir}

Error message

Shared scripts source directory not found: ${srcScriptsDir}

What it means

Thrown by Installer._installSharedScripts when `<srcDir>/src/scripts` does not exist (fs.pathExists is false). The installer expects to sync shared runtime Python scripts (e.g. resolve_customization.py) from source into _bmad/scripts/; a missing source dir means the package is incomplete or the wrong source root was resolved.

Source

Thrown at tools/installer/core/installer.js:671

        await fs.copy(modifiedFile.path, tempBackupPath, { overwrite: true });
      }
    }

    return { tempBackupDir, tempModifiedBackupDir };
  }

  /**
   * Sync src/scripts/* → _bmad/scripts/ so shared Python scripts
   * (e.g. resolve_customization.py) are available at install time.
   * Excludes dev-only tests and Python caches so they don't ship to users.
   * Wipes the destination first so files removed or renamed in source
   * don't linger and get recorded as installed. Also seeds
   * gitignore files for personal overrides and generated render snapshots.
   */
  async _installSharedScripts(paths) {
    const srcScriptsDir = path.join(paths.srcDir, 'src', 'scripts');
    if (!(await fs.pathExists(srcScriptsDir))) {
      throw new Error(`Shared scripts source directory not found: ${srcScriptsDir}`);
    }

    await fs.remove(paths.scriptsDir);
    await fs.ensureDir(paths.scriptsDir);
    // Ship only the runtime scripts — dev-only tests and Python caches must not land in user projects.
    const isInstallable = (srcPath) => {
      const base = path.basename(srcPath);
      return base !== 'tests' && base !== '__pycache__' && base !== '.pytest_cache' && !base.endsWith('.pyc');
    };
    await fs.copy(srcScriptsDir, paths.scriptsDir, { overwrite: true, filter: isInstallable });
    await this._trackFilesRecursive(paths.scriptsDir);

    const customGitignore = path.join(paths.customDir, '.gitignore');
    if (!(await fs.pathExists(customGitignore))) {
      await fs.writeFile(customGitignore, '*.user.toml\n', 'utf8');
      this.installedFiles.add(customGitignore);
    }

View on GitHub (pinned to b70486b9bd)

Solutions

  1. Verify src/scripts exists in the BMAD source: `ls <srcDir>/src/scripts`.
  2. Reinstall or re-clone the BMAD package from a complete source.
  3. Ensure getProjectRoot() resolves to the directory that contains both package.json and src/.
Defensive patterns

Strategy: validation

Validate before calling

const srcScriptsDir = path.join(paths.srcDir, 'src', 'scripts');
if (!(await fs.pathExists(srcScriptsDir))) {
  throw new Error('BMAD source is incomplete: src/scripts missing. Reinstall BMAD.');
}

Try / catch

try {
  await installer._installSharedScripts(paths);
} catch (error) {
  if (error.message.startsWith('Shared scripts source directory not found')) { /* reinstall package */ }
  throw error;
}

Prevention

When it happens

Trigger: During install/update, _installSharedScripts runs with paths.srcDir that lacks a `src/scripts` subdirectory.

Common situations: A trimmed/packaged BMAD distribution that omitted src/scripts, running the installer from a partial clone, or a custom project-root override that points elsewhere.

Related errors


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