{"record":{"id":"8d03ac7478c9d1db","repo":"heygen-com/hyperframes","slug":"lambda-policies-validate-usage-hyperframes-lamb","errorCode":null,"errorMessage":"[lambda policies validate] usage: hyperframes lambda policies validate <policy.json>","messagePattern":"\\[lambda policies validate\\] usage: hyperframes lambda policies validate <policy\\.json>","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/lambda/policies.ts","lineNumber":252,"sourceCode":"      const trust = buildRoleTrustPolicy();\n      const inline = buildPolicyDocument();\n      const wrapped = {\n        TrustRelationship: trust,\n        InlinePolicy: inline,\n      };\n      console.log(JSON.stringify(wrapped, null, 2));\n      return;\n    }\n    case \"validate\": {\n      if (!args.inputPath) {\n        const msg =\n          \"[lambda policies validate] usage: hyperframes lambda policies validate <policy.json>\";\n        if (args.json) {\n          console.log(JSON.stringify({ ok: false, error: msg }, null, 2));\n          setCommandExitCode(1);\n          return;\n        }\n        throw new Error(msg);\n      }\n      let result: ValidateResult;\n      try {\n        result = validatePolicy(args.inputPath);\n      } catch (err) {\n        const msg = normalizeErrorMessage(err);\n        if (args.json) {\n          console.log(JSON.stringify({ ok: false, error: msg }, null, 2));\n          setCommandExitCode(1);\n          return;\n        }\n        console.error(c.error(`Failed to validate ${args.inputPath}: ${msg}`));\n        setCommandExitCode(1);\n        return;\n      }\n      if (args.json) {\n        console.log(JSON.stringify({ ok: result.missing.length === 0, ...result }, null, 2));\n        if (result.missing.length > 0) setCommandExitCode(1);","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/commands/lambda/policies.ts#L234-L270","documentation":"Thrown by the `policies validate` subcommand when no positional policy JSON path was supplied (args.inputPath is undefined). The validate verb needs exactly one argument — the path to the IAM policy JSON to check against the CLI's required-actions list. Without it there is nothing to validate, so the command prints usage and (in --json mode) emits a structured error instead of throwing.","triggerScenarios":"Running `hyperframes lambda policies validate` with no positional argument. Note the dispatcher threads args.extra as inputPath, so the path must be the third positional: `policies validate <policy.json>`.","commonSituations":"Forgetting the path; passing it as a flag (`--file x.json`) instead of a positional; a shell where the glob/path didn't expand.","solutions":["Add the policy JSON path as a positional: `hyperframes lambda policies validate ./infra/iam/hyperframes.json`.","If you want machine-readable output, add `--json`: it returns `{ok:false,error:...}` with exit code 1 instead of throwing.","Run `hyperframes lambda policies user` first to see the canonical required policy, then validate your file against it."],"exampleFix":"# before\nhyperframes lambda policies validate\n# after\nhyperframes lambda policies validate ./infra/iam/hyperframes.json","handlingStrategy":"validation","validationCode":"// Ensure a policy path is present before calling policies validate\nfunction assertPolicyPath(extra?: string): string {\n  if (!extra) throw new Error(\"usage: hyperframes lambda policies validate <policy.json>\");\n  return extra;\n}","typeGuard":"function isPolicyPath(v: unknown): v is string {\n  return typeof v === \"string\" && v.trim() !== \"\";\n}","tryCatchPattern":"try {\n  await runPolicies({ verb: \"validate\", inputPath, json: true });\n} catch (err) {\n  if (/usage: hyperframes lambda policies validate/.test((err as Error).message))) {\n    // add the policy.json positional argument\n  }\n}","preventionTips":["Remember policies validate takes a POSITIONAL path, not --file.","Use --json in scripts for structured {ok,error} output with exit 1 instead of a throw.","Run `hyperframes lambda policies user` first to see the canonical policy to validate against."],"tags":["cli","lambda","iam","policies","input-validation","required-arg"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}