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

Path does not exist: ${resolved}

Error message

Path does not exist: ${resolved}

What it means

Thrown by resolveSource() when parseSource() identifies the input as a local path but path.resolve() points to a directory that does not exist on disk (fs.pathExistsSync returns false). The resolved absolute path is included in the message.

Source

Thrown at tools/installer/modules/custom-module-manager.js:331

    if (!Array.isArray(plugins) || plugins.length === 0) {
      throw new Error('marketplace.json contains no plugins');
    }

    return plugins.map((plugin) => this._normalizeCustomModule(plugin, sourceUrl, marketplaceData));
  }

  // ─── Source Resolution ────────────────────────────────────────────────────

  /**
   * High-level coordinator: parse input, clone if URL, determine discovery vs direct mode.
   * @param {string} input - URL or local path
   * @param {Object} [options] - Options passed to cloneRepo
   * @returns {Object} { parsed, rootDir, repoPath, sourceUrl, marketplace, mode: 'discovery'|'direct' }
   */
  async resolveSource(input, options = {}) {
    const parsed = this.parseSource(input);
    if (!parsed.isValid) throw new Error(parsed.error);

    let rootDir;
    let repoPath;
    let sourceUrl;

    if (parsed.type === 'local') {
      rootDir = parsed.localPath;
      repoPath = null;
      sourceUrl = null;
    } else {
      repoPath = await this.cloneRepo(input, options);
      sourceUrl = parsed.cloneUrl;
      rootDir = parsed.subdir ? path.join(repoPath, parsed.subdir) : repoPath;

      if (parsed.subdir && !(await fs.pathExists(rootDir))) {
        throw new Error(`Subdirectory '${parsed.subdir}' not found in cloned repository`);
      }
    }

View on GitHub (pinned to b70486b9bd)

Solutions

  1. Verify the directory exists at the resolved absolute path shown in the error message.
  2. If using a relative path, check it relative to the process's current working directory.
  3. Clone or create the source repository at the expected location first.
  4. If the path should be remote, use a full Git URL instead.

Example fix

// before
await mgr.resolveSource('./mymodules/typo-dir');

// after
await mgr.resolveSource('./mymodules/correct-dir');
// or verify with fs first:
// const path = require('path');
// const resolved = path.resolve('./mymodules/correct-dir');
// if (!fs.existsSync(resolved)) throw new Error('fix path');
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
const path = require('path');
const os = require('os');

function resolveAndCheck(input) {
  const expanded = input.startsWith('~') ? path.join(os.homedir(), input.slice(1)) : input;
  const resolved = path.resolve(expanded);
  if (!fs.existsSync(resolved)) {
    throw new Error(`Path does not exist: ${resolved}`);
  }
  return resolved;
}

const checked = resolveAndCheck(input);
await mgr.resolveSource(checked);

Try / catch

try {
  await mgr.resolveSource(localPath);
} catch (e) {
  if (e.message.startsWith('Path does not exist')) {
    console.error('The local path was not found. Verify the directory exists.');
    // Optionally prompt user for corrected path
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling resolveSource('./nonexistent/dir'), resolveSource('~/missing-module'), or any local path that doesn't exist. The ~ is expanded via os.homedir() before the existence check.

Common situations: Typo in the path; the module directory was deleted or never cloned; relative path resolved against an unexpected working directory; home directory expansion doesn't match where the user expects.

Related errors


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