{"record":{"id":"48b269800a04f298","repo":"bmad-code-org/BMAD-METHOD","slug":"path-does-not-exist-resolved","errorCode":null,"errorMessage":"Path does not exist: ${resolved}","messagePattern":"Path does not exist: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tools/installer/modules/custom-module-manager.js","lineNumber":331,"sourceCode":"\n    if (!Array.isArray(plugins) || plugins.length === 0) {\n      throw new Error('marketplace.json contains no plugins');\n    }\n\n    return plugins.map((plugin) => this._normalizeCustomModule(plugin, sourceUrl, marketplaceData));\n  }\n\n  // ─── Source Resolution ────────────────────────────────────────────────────\n\n  /**\n   * High-level coordinator: parse input, clone if URL, determine discovery vs direct mode.\n   * @param {string} input - URL or local path\n   * @param {Object} [options] - Options passed to cloneRepo\n   * @returns {Object} { parsed, rootDir, repoPath, sourceUrl, marketplace, mode: 'discovery'|'direct' }\n   */\n  async resolveSource(input, options = {}) {\n    const parsed = this.parseSource(input);\n    if (!parsed.isValid) throw new Error(parsed.error);\n\n    let rootDir;\n    let repoPath;\n    let sourceUrl;\n\n    if (parsed.type === 'local') {\n      rootDir = parsed.localPath;\n      repoPath = null;\n      sourceUrl = null;\n    } else {\n      repoPath = await this.cloneRepo(input, options);\n      sourceUrl = parsed.cloneUrl;\n      rootDir = parsed.subdir ? path.join(repoPath, parsed.subdir) : repoPath;\n\n      if (parsed.subdir && !(await fs.pathExists(rootDir))) {\n        throw new Error(`Subdirectory '${parsed.subdir}' not found in cloned repository`);\n      }\n    }","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/bmad-code-org/BMAD-METHOD/blob/b70486b9bdcb0a404d329e2a763b57964e7f1360/tools/installer/modules/custom-module-manager.js#L313-L349","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the directory exists at the resolved absolute path shown in the error message.","If using a relative path, check it relative to the process's current working directory.","Clone or create the source repository at the expected location first.","If the path should be remote, use a full Git URL instead."],"exampleFix":"// before\nawait mgr.resolveSource('./mymodules/typo-dir');\n\n// after\nawait mgr.resolveSource('./mymodules/correct-dir');\n// or verify with fs first:\n// const path = require('path');\n// const resolved = path.resolve('./mymodules/correct-dir');\n// if (!fs.existsSync(resolved)) throw new Error('fix path');","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nconst os = require('os');\n\nfunction resolveAndCheck(input) {\n  const expanded = input.startsWith('~') ? path.join(os.homedir(), input.slice(1)) : input;\n  const resolved = path.resolve(expanded);\n  if (!fs.existsSync(resolved)) {\n    throw new Error(`Path does not exist: ${resolved}`);\n  }\n  return resolved;\n}\n\nconst checked = resolveAndCheck(input);\nawait mgr.resolveSource(checked);","typeGuard":null,"tryCatchPattern":"try {\n  await mgr.resolveSource(localPath);\n} catch (e) {\n  if (e.message.startsWith('Path does not exist')) {\n    console.error('The local path was not found. Verify the directory exists.');\n    // Optionally prompt user for corrected path\n  }\n  throw e;\n}","preventionTips":["Verify local paths exist with fs.existsSync before passing to the installer.","Use absolute paths to avoid working-directory ambiguity.","Expand ~ manually or use os.homedir() for clarity."],"tags":["filesystem","local-path","input-validation"],"backgroundTag":null,"analyzedSha":"b70486b9bdcb0a404d329e2a763b57964e7f1360","analyzedAt":"2026-08-13T01:21:12.247Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}