JuliusBrussee/caveman · error · Error
cave_cache_volatile_stable_slot
cave_cache_volatile_stable_slot
Error message
cave_cache_volatile_stable_slot
What it means
Thrown when an efficiency plan routes multiple prompt segments but the instructions/tools prefix is "volatile stable" — content that changes between calls yet sits in a prefix position that caching depends on. Caching such a slot would produce unreliable cache hits, so the library refuses the plan up front.
Solutions
- Make the instructions and tool definitions byte-stable across calls (remove timestamps/random content) when using an efficiency plan
- Disable segment routing in the efficiencyPlan (empty segment_routes)
- Regenerate the instructions deterministically or freeze them for the run
Example fix
// before
const instructions = `You are X. Run ${Date.now()}`;
streamAgent({ instructions, efficiencyPlan });
// after
const instructions = `You are X.`;
streamAgent({ instructions, efficiencyPlan }); Defensive patterns
Strategy: validation
Validate before calling
if (efficiencyPlan?.segment_routes.length && /Date\.now|Math\.random|crypto\.randomUUID/.test(instructions)) {
throw new Error("instructions must be byte-stable for segment routing");
} Try / catch
try { await streamAgent(opts); } catch (e) { if (e.message === "cave_cache_volatile_stable_slot") { /* stabilize prefix or drop segment routing */ } else throw e; } Prevention
- Keep instructions and tool definitions deterministic across calls
- Never embed timestamps/random IDs in cached prefix positions
- Enable segment routing only on frozen, stable prefixes
When it happens
Trigger: Calling streamAgent with an efficiencyPlan whose segment_routes.length > 0 while volatileStablePrefix(instructions, definition.tools) reports the stable-but-volatile prefix condition (e.g. instructions or tool definitions contain nondeterministic content like timestamps or generated IDs).
Common situations: Building instructions with Date.now(), random IDs, or per-run content while also enabling efficiency-plan segment routing; a cache-epoch change that cleared the prefix digest right before planning.
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
- aes cipher
- apiKey, baseURL, and agent are required
- ASGI context resolver or request bounds are invalid
- assembly slot changed after being declared stable
- AutoGen tools and workbench are mutually exclusive
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/f8d64561eb69e773.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/runtime.ts:1405
provider: routedModel.provider,
model: routedModel.id,
api: routedModel.api,
prefixDigest,
buildIdentity: buildIdentity ?? null,
lockedPlanSHA256: buildIdentity?.planSha256 ?? null,
executionPlanSHA256: efficiencyPlan === undefined
? null
: sha256(stableStringify(efficiencyPlan)),
}));
if (conversation?.fingerprint !== undefined &&
conversation.fingerprint !== conversationFingerprint) {
conversation.cachePrefixDigest = undefined;
conversation.providerFrozen = undefined;
conversation.originalFrozen = undefined;
}
if (conversation) conversation.fingerprint = conversationFingerprint;
if (efficiencyPlan?.segment_routes.length && volatileStablePrefix(instructions, definition.tools)) {
throw new Error("cave_cache_volatile_stable_slot");
}
// Every x-cave-* header exists for the Caveman gateway: x-cave-api-key is
// an account credential, and agent/workflow/session/cache-epoch/prefix
// digest/context bill/build+plan digests are account-linked identifiers and
// internal telemetry. A request that does not go through the gateway goes to
// a third party, so it carries none of them.
const headers = gatewayActive
? runtimeHeaders(
definition.id,
options.workflow ?? definition.id,
sessionId,
buildIdentity,
bill,
appliedPlan.appliedTransformIDs,
prefixDigest,
conversationFingerprint,
executionContext.invocationState.batch?.apiKey,
executionContext.invocationState.batch === undefined ? undefined : executionContext.invocationTrace,View on GitHub (pinned to 3ee70a1026)