{"record":{"id":"ba3e945b6b01a007","repo":"heygen-com/hyperframes","slug":"hyperframes-lambda-could-not-find-the-repo-root","errorCode":null,"errorMessage":"[hyperframes lambda] could not find the repo root (no packages/aws-lambda/ above this CLI's source). Run `hyperframes lambda` from within a hyperframes checkout, or set HYPERFRAMES_REPO_ROOT explicitly.","messagePattern":"\\[hyperframes lambda\\] could not find the repo root \\(no packages/aws-lambda/ above this CLI's source\\)\\. Run `hyperframes lambda` from within a hyperframes checkout, or set HYPERFRAMES_REPO_ROOT explicitly\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/lambda/repoRoot.ts","lineNumber":29,"sourceCode":"import { existsSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport function repoRoot(): string {\n  const override = process.env.HYPERFRAMES_REPO_ROOT;\n  if (override && existsSync(resolve(override, \"packages\", \"aws-lambda\", \"package.json\"))) {\n    return override;\n  }\n  let dir = dirname(fileURLToPath(import.meta.url));\n  for (let depth = 0; depth < 12; depth++) {\n    if (existsSync(resolve(dir, \"packages\", \"aws-lambda\", \"package.json\"))) {\n      return dir;\n    }\n    const parent = dirname(dir);\n    if (parent === dir) break;\n    dir = parent;\n  }\n  throw new Error(\n    \"[hyperframes lambda] could not find the repo root (no packages/aws-lambda/ above this CLI's source). \" +\n      \"Run `hyperframes lambda` from within a hyperframes checkout, or set HYPERFRAMES_REPO_ROOT explicitly.\",\n  );\n}\n","sourceCodeStart":11,"sourceCodeEnd":34,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/commands/lambda/repoRoot.ts#L11-L34","documentation":"Thrown by repoRoot() when it cannot locate the HyperFrames repository root — i.e. a directory containing `packages/aws-lambda/package.json` — within 12 ancestor levels of this source file, AND no valid HYPERFRAMES_REPO_ROOT override is set. The `lambda deploy`/`destroy` commands need the repo root to find the SAM template and the handler ZIP build script, so when the CLI is invoked from outside a checkout (e.g. a globally-installed CLI) and no override is given, this fires with an actionable hint.","triggerScenarios":"Running `hyperframes lambda deploy` or `lambda destroy` from a globally-installed CLI that isn't inside a HyperFrames repo checkout, with HYPERFRAMES_REPO_ROOT unset or pointing somewhere without packages/aws-lambda/.","commonSituations":"`npm install -g hyperframes` and then running `lambda deploy` from an unrelated project directory; the override env var points at a stale path; running inside a container that only mounted part of the repo.","solutions":["Run `hyperframes lambda` from within a HyperFrames checkout (`git clone` first if needed).","Set HYPERFRAMES_REPO_ROOT to the absolute path of your checkout root: `export HYPERFRAMES_REPO_ROOT=/path/to/hyperframes`.","Verify the override resolves: the directory must contain `packages/aws-lambda/package.json`."],"exampleFix":"# before\nhyperframes lambda deploy  # run from outside the repo\n# after — point at the checkout\nexport HYPERFRAMES_REPO_ROOT=/src/hyperframes\nhyperframes lambda deploy","handlingStrategy":"validation","validationCode":"// Confirm repo root is discoverable before invoking lambda deploy/destroy\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nfunction assertRepoRootKnown(): string {\n  const override = process.env.HYPERFRAMES_REPO_ROOT;\n  const root = override ?? process.cwd();\n  if (!existsSync(resolve(root, \"packages\", \"aws-lambda\", \"package.json\"))) {\n    throw new Error(\"Set HYPERFRAMES_REPO_ROOT to a HyperFrames checkout\");\n  }\n  return root;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const root = repoRoot();\n} catch (err) {\n  if (/could not find the repo root/.test((err as Error).message))) {\n    process.env.HYPERFRAMES_REPO_ROOT = \"/path/to/hyperframes\";\n    // retry\n  }\n}","preventionTips":["Set HYPERFRAMES_REPO_ROOT in your shell/DOTENV for any environment running `lambda deploy`.","Clone the full HyperFrames repo rather than installing the CLI globally for Lambda workflows.","Verify the override contains packages/aws-lambda/package.json before invoking."],"tags":["cli","lambda","environment","repo-root","deploy","configuration"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}