JuliusBrussee/caveman · error

cave_execution_authorization_private

cave_execution_authorization_private

Error message

cave_execution_authorization_private

What it means

rejectInternalOptions is a fail-closed guard on the public Claude executor: if a caller passes options named lockedBuild, candidatePlan, or queryFn, it throws because those fields are framework-internal build/plan identity and transport injection. Public calls can never forge locked-build provenance or substitute the SDK query function.

Solutions

  1. Remove lockedBuild, candidatePlan, and queryFn from the options you pass; use the public compiler/CLI path (build command) for locked execution.
  2. If you spread user/parent options, explicitly strip internal keys before forwarding.
  3. For provider mocking in tests, use the package's own internal test entry points rather than the public facade.

Example fix

// before
await runClaudeAgent({ ...internalOptions, prompt });
// after
const { lockedBuild, candidatePlan, queryFn, ...publicOptions } = internalOptions;
await runClaudeAgent({ ...publicOptions, prompt });
Defensive patterns

Strategy: type-guard

Validate before calling

const INTERNAL_KEYS = ["lockedBuild", "candidatePlan", "queryFn"];
function stripInternalOptions(options) {
  const out = { ...options };
  for (const k of INTERNAL_KEYS) delete out[k];
  return out;
}

Type guard

function isPublicOptions(v) { return v != null && !("lockedBuild" in v) && !("candidatePlan" in v) && !("queryFn" in v); }

Try / catch

try {
  await runClaudeAgent(options);
} catch (e) {
  if (e.message === "cave_execution_authorization_private") {
    throw new Error("Internal framework options must not be passed to the public Claude executor");
  }
  throw e;
}

Prevention

When it happens

Trigger: Spreading an internal options object (or a captured object from a framework-internal path) into the public run call; constructing options with those keys to try to reuse a compiled build or mock the provider from outside the package.

Common situations: Copying internal test/setup code that sets lockedBuild or queryFn into application code; forwarding rest-spread options from a wrapper that inadvertently picked up internal keys.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/4a0f3bf576b55526. Report an issue: GitHub.

Appendix: source

Thrown at packages/agent/src/claude-runtime.ts:591

  // OAuth subscription runs still expose provider token counts, but catalog
  // list price is not money this run paid. Unknown auth also fails closed to
  // the honest zero rather than guessing a metered credential.
  return { ...usage, priced: false, catalogCostUsd: 0 };
}

function integer(value: unknown): number {
  return Number.isSafeInteger(value) && Number(value) >= 0 ? Number(value) : 0;
}

function unprefixClaudeTool(name: string): string {
  const prefix = "mcp__caveman_agent__";
  return name.startsWith(prefix) ? name.slice(prefix.length) : name;
}

function rejectInternalOptions(options: ClaudeRunOptions): void {
  const value = options as Record<string, unknown>;
  if ("lockedBuild" in value || "candidatePlan" in value || "queryFn" in value) {
    throw new Error("cave_execution_authorization_private");
  }
}

function isRecord(value: unknown): value is Record<string, unknown> {
  return value !== null && typeof value === "object" && !Array.isArray(value);
}

View on GitHub (pinned to 3ee70a1026)