JuliusBrussee/caveman · error · AssemblyStabilityError

AssemblyStabilityError(slot.id)

Error message

AssemblyStabilityError(slot.id)

What it means

Thrown while validating assembly slots: a slot declares a stability tier other than the three known values ('stable', 'session', 'volatile'). Assembly caching keys off the stability tier, so an unrecognized tier cannot be defaulted; the offending slot id is included via the AssemblyStabilityError wrapper.

Solutions

  1. Set the slot's stability to 'stable', 'session', or 'volatile'
  2. Check for typos or a stale stability literal from an older SDK version
  3. Reclassify content that does not fit a tier into a new slot with the closest tier
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/sdk/typescript/src/index.ts:1843 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/89c548fd1f7ba103. Report an issue: GitHub.

Appendix: source

Thrown at packages/sdk/typescript/src/index.ts:1843

    assemblyHashLedgers.set(cave, ledger);
  }
  const normalized = options.slots.map((slot) => {
    if (!slot.id || ids.has(slot.id)) throw new Error(`assembly slot id must be non-empty and unique: ${JSON.stringify(slot.id)}`);
    ids.add(slot.id);
    if (!["stable", "session", "volatile"].includes(slot.stability)) {
      throw new Error(`assembly slot ${JSON.stringify(slot.id)} has unknown stability ${JSON.stringify(slot.stability)}`);
    }
    let contentJSON: string;
    try {
      contentJSON = canonicalJSON(slot.content);
    } catch {
      throw new Error(`assembly slot ${JSON.stringify(slot.id)} content is not JSON-serializable`);
    }
    const contentHash = sha256Hex(contentJSON);
    if (slot.stability !== "volatile") {
      const key = `${options.sessionId}\0${slot.id}`;
      const previous = ledger.get(key);
      if (previous !== undefined && previous !== contentHash) throw new AssemblyStabilityError(slot.id);
      ledger.set(key, contentHash);
    }
    return { ...slot, content: JSON.parse(contentJSON) as unknown };
  });

  const ordered = (["stable", "session", "volatile"] as const)
    .flatMap((stability) => normalized.filter((slot) => slot.stability === stability));
  const prefixSlots = ordered.filter((slot) => slot.stability !== "volatile");
  const volatileSlots = ordered.filter((slot) => slot.stability === "volatile");

  let request: Record<string, unknown>;
  let prefixBytes: string;
  let breakpoints: string[] = [];

  if (provider === "anthropic") {
    const toolsSlot = prefixSlots.find((slot) => slot.id === "tools" && Array.isArray(slot.content));
    const systemSlots = prefixSlots.filter((slot) => slot !== toolsSlot);
    const system = systemSlots.map((slot) => ({ type: "text", text: assemblyText(slot.content) }));

View on GitHub (pinned to 3ee70a1026)