{"record":{"id":"91829aa74600fdf6","repo":"affaan-m/ECC","slug":"cannot-locate-reporelativepath-above-dirname","errorCode":null,"errorMessage":"Cannot locate ${repoRelativePath} above ${__dirname}","messagePattern":"Cannot locate (.+?) above (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ci/validate-hooks.js","lineNumber":30,"sourceCode":" * Resolve a module by its repo-relative path.\n *\n * Test harnesses copy this validator to the repo root before running it, so a\n * plain relative require would break. Walk up from __dirname until the module\n * is found instead.\n *\n * @param {string} repoRelativePath - e.g. 'scripts/lib/hooks-config.js'\n * @returns {string} absolute path to the module\n */\nfunction resolveRepoModule(repoRelativePath) {\n  let dir = __dirname;\n  for (;;) {\n    const candidate = path.join(dir, repoRelativePath);\n    if (fs.existsSync(candidate)) {\n      return candidate;\n    }\n    const parent = path.dirname(dir);\n    if (parent === dir) {\n      throw new Error(`Cannot locate ${repoRelativePath} above ${__dirname}`);\n    }\n    dir = parent;\n  }\n}\n\nconst {\n  METADATA_FILENAME,\n  applyHooksMetadata,\n  findMetadataMismatches,\n  metadataPathFor,\n  withRefreshedFingerprints,\n} = require(resolveRepoModule('scripts/lib/hooks-config.js'));\n\nconst HOOKS_FILE = path.join(__dirname, '../../hooks/hooks.json');\nconst HOOKS_SCHEMA_PATH = path.join(__dirname, '../../schemas/hooks.schema.json');\nconst METADATA_SCHEMA_PATH = path.join(__dirname, '../../schemas/hooks-metadata.schema.json');\n// `--update-fingerprints` rewrites the sidecar's fingerprints from the current\n// hooks.json instead of validating. Run it after changing a hook command.","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/ci/validate-hooks.js#L12-L48","documentation":"resolveRepoModule walks up from __dirname looking for a repo-relative module (e.g. scripts/lib/hooks-config.js) and throws when no ancestor directory contains it. This happens when the validator is copied out of the repo without the referenced library, or the library file was moved/deleted — the faulting input is repoRelativePath.","triggerScenarios":"Thrown at scripts/ci/validate-hooks.js:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the validator from a full checkout that contains scripts/lib/hooks-config.js.","Restore the missing library file or fix the repoRelativePath constant.","If used in a copied test harness, copy the lib directory alongside the validator."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}