JuliusBrussee/caveman · error
cave_gateway_required_for_locked_plan
cave_gateway_required_for_locked_plan
Error message
cave_gateway_required_for_locked_plan: Cave Build execution routes through the Caveman gateway; run unlocked for observe-only
What it means
A run carrying a locked build or candidate plan (`planPresent`) was explicitly configured with `cave: "off"`. Locked-plan execution routes through the Caveman gateway by contract; silently degrading to observe-only would break the plan's guarantees, so the runtime throws. Without a plan, `cave: "off"` is fine and yields observe-only mode.
Solutions
- Remove `cave: "off"` (or set `cave` to the gateway mode) so the locked plan can route through the gateway
- Run unlocked (drop the locked build/candidate plan) if you deliberately want an observe-only, non-gateway run
- Separate configs: keep locked-plan runs on gateway routing and use `cave: "off"` only for plain unlocked runs
Example fix
// before
await run({ ...planOptions, cave: "off" });
// after
await run({ ...planOptions }); // gateway routing for the locked plan
// or, for observe-only:
await run({ prompt }); // no locked plan, cave off allowed Defensive patterns
Strategy: validation
Validate before calling
if (options.cave === 'off' && (options.lockedBuild || options.candidatePlan || 'efficiencyPlan' in options)) throw new Error('cave: "off" cannot be combined with a locked plan'); Try / catch
try { await run(options); } catch (e) { if (String((e as Error).message).startsWith('cave_gateway_required_for_locked_plan')) { /* either enable gateway routing or drop the plan */ } else throw e; } Prevention
- Keep cave on (gateway routing) for all locked-plan/optimized runs
- Use cave: "off" only for plain unlocked runs
- Audit shared config for a global cave-off setting before attaching plans
When it happens
Trigger: Calling `run()`/`startCodingSession()` with `cave: "off"` while the options (or session defaults) include a locked build or candidate plan — e.g. explicitly disabling the gateway on an optimized run, or a config file that sets `cave: "off"` globally while the build compiler attached a plan.
Common situations: Setting `CAVE=off`-style config to 'save money' while still running an optimized/locked build, a shared config that disables cave for all runs including locked ones, or upgrading from an unlocked workflow to a locked one without re-enabling the gateway.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- cave_gateway_identity_unverified
- aes cipher
- apiKey, baseURL, and agent are required
- ASGI context resolver or request bounds are invalid
- AutoGen tools and workbench are mutually exclusive
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/a8b428f29fa75d63.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/runtime.ts:5094
billingProofRequired?: boolean;
},
planPresent: boolean,
): Promise<ResolvedCaveRoute> {
if (options.caveRoute !== undefined) {
if (!options.billingProofRequired || !options.caveRoute.useGateway ||
options.caveRoute.providerBilling === "managed" ||
options.caveRoute.providerBilling === "byok") {
return options.caveRoute;
}
const identity = await gatewayIdentity(gatewayURL, options.fetch ?? globalThis.fetch);
return {
...options.caveRoute,
providerBilling: identity?.providerBilling ?? "unknown",
};
}
if (options.cave === "off") {
if (planPresent) {
throw new Error(
"cave_gateway_required_for_locked_plan: Cave Build execution routes through the Caveman gateway; run unlocked for observe-only",
);
}
return { useGateway: false, providerBilling: "unknown" };
}
if (options.ensureRuntime === false) {
try {
const url = new URL(gatewayURL);
if (isLoopbackHostname(url.hostname)) {
const providerBilling = options.billingProofRequired
? (await gatewayIdentity(gatewayURL, options.fetch ?? globalThis.fetch))?.providerBilling ??
"unknown"
: "unknown";
return { useGateway: true, providerBilling };
}
// Remote gateways still have to prove Caveman identity. `ensureCaveRuntime`
// never starts a process for non-loopback URLs; it only enforces HTTPS and
// performs the content-blind ownership handshake.View on GitHub (pinned to 3ee70a1026)