JuliusBrussee/caveman · error
caveman build: agent definition contains an unsupported…
Error message
caveman build: agent definition contains an unsupported value
What it means
Thrown by lockableValue while hashing an agent definition: the value tree contains a type that has no lockable representation (anything beyond null/string/boolean/number/bigint/object/array; functions, undefined and symbols are dropped). The definition therefore cannot be stably serialized into the build lock.
Solutions
- Remove the unsupported value from the agent definition (e.g. a class instance, Map, Set, or Symbol stored in tool config)
- Convert the value to a plain JSON-representable structure before passing it in
- Store non-lockable state outside the definition and reference it by id/path
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/agent/src/build.ts:582 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/d6272fa2e2584c68.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/build.ts:582
export function toolDefinitionSHA256(tool: ToolDefinition): string {
return sha256(stableStringify(lockableValue(tool, new WeakSet<object>())));
}
export function contextIRSHA256(contextIR: ContextIR): string {
return sha256(stableStringify(contextIRToWire(contextIR)));
}
function lockableValue(value: unknown, seen: WeakSet<object>): unknown {
if (value === null || typeof value === "string" || typeof value === "boolean" ||
typeof value === "number") {
return value;
}
if (typeof value === "bigint") return { cave_bigint: value.toString() };
if (typeof value === "function" || typeof value === "undefined" || typeof value === "symbol") {
return undefined;
}
if (typeof value !== "object") {
throw new Error("caveman build: agent definition contains an unsupported value");
}
if (seen.has(value)) throw new Error("caveman build: cyclic agent definition is not lockable");
seen.add(value);
try {
if (Array.isArray(value)) {
return value.map((item) => lockableValue(item, seen) ?? null);
}
const projected: Record<string, unknown> = {};
for (const [key, item] of Object.entries(value)) {
const locked = lockableValue(item, seen);
if (locked !== undefined) projected[key] = locked;
}
const implementationSource = Reflect.get(
value,
Symbol.for("@caveman-ai/agent:tool-implementation-source"),
);
if (typeof implementationSource === "string") {
projected.cave_tool_implementation_sha256 = sha256(implementationSource);View on GitHub (pinned to 3ee70a1026)