{"record":{"id":"6cad83790d26c8b7","repo":"alibaba/open-code-review","slug":"could-not-locate-rel-searched-roots-roots-j","errorCode":null,"errorMessage":"Could not locate ${REL}; searched roots: ${roots.join(', ')}","messagePattern":"Could not locate (.+?); searched roots: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"action.yml","lineNumber":512,"sourceCode":"            core.setOutput('range_summary', summary);\n            core.setOutput('checkpoint_before', range.checkpointBefore || '');\n            core.setOutput('ancestry', range.ancestry || '');\n            core.setOutput('source_run', range.sourceRun || '');\n            core.setOutput('config_fingerprint', fingerprint);\n            core.setOutput('checkpoint_carry', carry);\n            core.info(`[checkpoint] reviewing ${summary}`);\n          };\n\n          // This step only chooses where the review starts, and every failure it\n          // can hit has the same safe answer: review the whole merge-base range.\n          // So nothing in here may fail the job — a missing helper or an API\n          // outage must not block a review the action can still perform.\n          try {\n            // Same helper lookup as the posting step below.\n            const REL = 'scripts/github-actions/post-review-comments.js';\n            const roots = [process.env.GITHUB_ACTION_PATH, process.env.GITHUB_WORKSPACE].filter(Boolean);\n            const helper = roots.map(r => path.resolve(r, REL)).find(p => fs.existsSync(p));\n            if (!helper) throw new Error(`Could not locate ${REL}; searched roots: ${roots.join(', ')}`);\n            const { resolveCheckpointRange, readCheckpointComment } = require(helper);\n\n            const sha256 = (buf) => crypto.createHash('sha256').update(buf).digest('hex');\n            let ruleUnverified = false;\n\n            // `rule` names a JSON file that OCR reads off the workspace at review\n            // time (rules.NewResolver only touches disk when the path is non-empty;\n            // the default rule set is embedded in the binary and so already moves\n            // with OCR_VERSION_ACTUAL). Fingerprinting the *path* alone would let an\n            // edit to that file narrow the next range under rules the earlier\n            // commits were never reviewed against, so hash the contents too.\n            let ruleDigest = 'none';\n            const rulePath = process.env.OCR_RULE_PATH || '';\n            if (rulePath) {\n              try {\n                ruleDigest = sha256(fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE || '.', rulePath)));\n              } catch (e) {\n                // Cannot prove the rules are unchanged -> do not narrow. OCR itself","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/action.yml#L494-L530","documentation":"The GitHub Action's checkpoint-restoration step cannot find the helper script scripts/github-actions/post-review-comments.js in any of its search roots (GITHUB_ACTION_PATH, GITHUB_WORKSPACE). The step throws deliberately instead of continuing with a missing helper, because checkpoint logic cannot run without it. The comment above confirms the outage is non-fatal to the overall review, hence the surrounding try block.","triggerScenarios":"GITHUB_ACTION_PATH and GITHUB_WORKSPACE are unset or empty (both filtered out, leaving zero roots), or the JS bundle was not copied into the action image/workspace at scripts/github-actions/post-review-comments.js.","commonSituations":"Action packaged with dist-only layout while scripts/ is excluded from the published action; a composite step running in a container or workspace with a different checkout path; fork/renamed repo where the helper file was moved or deleted; runs where the repo is not checked out (actions/checkout missing) so GITHUB_WORKSPACE lacks scripts.","solutions":["Verify the repo is checked out before this step (actions/checkout runs first) so GITHUB_WORKSPACE contains scripts/github-actions/post-review-comments.js.","Ensure the helper script is committed/packaged with the action or bundled into the dist output the action ships.","Check that GITHUB_ACTION_PATH or GITHUB_WORKSPACE is set for the runner job; if running in a container, mount the workspace accordingly.","Treat the throw as expected non-fatal: keep the step in try/catch so a missing checkpoint helper degrades gracefully instead of failing the review."],"exampleFix":"// before\nif (!helper) throw new Error(`Could not locate ${REL}; searched roots: ${roots.join(', ')}`);\n// after\nif (!helper) {\n  core.warning(`Skipping checkpoint restore: ${REL} not found in ${roots.join(', ')}`);\n  return; // or fall through without checkpoint logic\n}","handlingStrategy":"fallback","validationCode":"const REL = 'scripts/github-actions/post-review-comments.js';\nconst roots = [process.env.GITHUB_ACTION_PATH, process.env.GITHUB_WORKSPACE].filter(Boolean);\nconst helper = roots.map(r => path.resolve(r, REL)).find(p => fs.existsSync(p));\nconst helperAvailable = Boolean(helper);\nif (!helperAvailable) core.warning(`checkpoint helper missing; searched: ${roots.join(', ')}`);","typeGuard":"function helperExists(roots) {\n  return typeof roots.find(r => fs.existsSync(path.resolve(r, 'scripts/github-actions/post-review-comments.js'))) === 'string';\n}","tryCatchPattern":"try {\n  const helper = roots.map(r => path.resolve(r, REL)).find(p => fs.existsSync(p));\n  if (!helper) throw new Error(`Could not locate ${REL}`);\n  const { resolveCheckpointRange } = require(helper);\n} catch (err) {\n  core.warning(`Checkpoint restore skipped: ${err.message}`);\n}","preventionTips":["Always run actions/checkout before steps that require repo scripts","Commit the helper script or bundle it into the action's published dist","Log GITHUB_ACTION_PATH and GITHUB_WORKSPACE early in the job for debugging","Keep the step wrapped in try/catch so checkpoint loss never fails the review"],"tags":["github-actions","missing-file","node"],"backgroundTag":"missing-helper-script","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}