{"record":{"id":"d6272fa2e2584c68","repo":"JuliusBrussee/caveman","slug":"caveman-build-agent-definition-contains-an-unsupp","errorCode":null,"errorMessage":"caveman build: agent definition contains an unsupported value","messagePattern":"caveman build: agent definition contains an unsupported value","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/build.ts","lineNumber":582,"sourceCode":"export function toolDefinitionSHA256(tool: ToolDefinition): string {\n  return sha256(stableStringify(lockableValue(tool, new WeakSet<object>())));\n}\n\nexport function contextIRSHA256(contextIR: ContextIR): string {\n  return sha256(stableStringify(contextIRToWire(contextIR)));\n}\n\nfunction lockableValue(value: unknown, seen: WeakSet<object>): unknown {\n  if (value === null || typeof value === \"string\" || typeof value === \"boolean\" ||\n      typeof value === \"number\") {\n    return value;\n  }\n  if (typeof value === \"bigint\") return { cave_bigint: value.toString() };\n  if (typeof value === \"function\" || typeof value === \"undefined\" || typeof value === \"symbol\") {\n    return undefined;\n  }\n  if (typeof value !== \"object\") {\n    throw new Error(\"caveman build: agent definition contains an unsupported value\");\n  }\n  if (seen.has(value)) throw new Error(\"caveman build: cyclic agent definition is not lockable\");\n  seen.add(value);\n  try {\n    if (Array.isArray(value)) {\n      return value.map((item) => lockableValue(item, seen) ?? null);\n    }\n    const projected: Record<string, unknown> = {};\n    for (const [key, item] of Object.entries(value)) {\n      const locked = lockableValue(item, seen);\n      if (locked !== undefined) projected[key] = locked;\n    }\n    const implementationSource = Reflect.get(\n      value,\n      Symbol.for(\"@caveman-ai/agent:tool-implementation-source\"),\n    );\n    if (typeof implementationSource === \"string\") {\n      projected.cave_tool_implementation_sha256 = sha256(implementationSource);","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/build.ts#L564-L600","documentation":"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.","triggerScenarios":"Thrown at packages/agent/src/build.ts:582 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}