{"record":{"id":"e78121bd4e925f2e","repo":"JuliusBrussee/caveman","slug":"assembly-slot-id-must-be-non-empty-and-unique-j","errorCode":null,"errorMessage":"assembly slot id must be non-empty and unique: ${JSON.stringify(slot.id)}","messagePattern":"assembly slot id must be non-empty and unique: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/sdk/typescript/src/index.ts","lineNumber":1816,"sourceCode":"const assemblyHashLedgers = new WeakMap<Cave, Map<string, string>>();\nconst assemblyRequestHeaders = new WeakMap<object, string>();\n\nfunction assemble(cave: Cave, options: AssembleOptions): AssemblyResult {\n  const provider = options.provider.trim().toLowerCase();\n  const emitCacheHints = options.emitCacheHints ?? \"gateway\";\n  if (!options.model || !options.sessionId) throw new Error(\"assemble requires model and sessionId\");\n  if (![\"gateway\", \"self\", \"none\"].includes(emitCacheHints)) {\n    throw new Error(`unknown emitCacheHints value ${JSON.stringify(emitCacheHints)}`);\n  }\n\n  const ids = new Set<string>();\n  let ledger = assemblyHashLedgers.get(cave);\n  if (!ledger) {\n    ledger = new Map<string, string>();\n    assemblyHashLedgers.set(cave, ledger);\n  }\n  const normalized = options.slots.map((slot) => {\n    if (!slot.id || ids.has(slot.id)) throw new Error(`assembly slot id must be non-empty and unique: ${JSON.stringify(slot.id)}`);\n    ids.add(slot.id);\n    if (![\"stable\", \"session\", \"volatile\"].includes(slot.stability)) {\n      throw new Error(`assembly slot ${JSON.stringify(slot.id)} has unknown stability ${JSON.stringify(slot.stability)}`);\n    }\n    let contentJSON: string;\n    try {\n      contentJSON = canonicalJSON(slot.content);\n    } catch {\n      throw new Error(`assembly slot ${JSON.stringify(slot.id)} content is not JSON-serializable`);\n    }\n    const contentHash = sha256Hex(contentJSON);\n    if (slot.stability !== \"volatile\") {\n      const key = `${options.sessionId}\\0${slot.id}`;\n      const previous = ledger.get(key);\n      if (previous !== undefined && previous !== contentHash) throw new AssemblyStabilityError(slot.id);\n      ledger.set(key, contentHash);\n    }\n    return { ...slot, content: JSON.parse(contentJSON) as unknown };","sourceCodeStart":1798,"sourceCodeEnd":1834,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/sdk/typescript/src/index.ts#L1798-L1834","documentation":"Error \"assembly slot id must be non-empty and unique: ${JSON.stringify(slot.id)}\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/sdk/typescript/src/index.ts:1816 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give each assembly slot a non-empty, unique id."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}