{"record":{"id":"6c1cd721f8641962","repo":"JuliusBrussee/caveman","slug":"cave-checkpoint-response-missing-source-ref-or-mes","errorCode":null,"errorMessage":"cave checkpoint response missing source_ref or messages","messagePattern":"cave checkpoint response missing source_ref or messages","errorType":"exception","errorClass":"CaveRequestError","httpStatus":200,"severity":"error","filePath":"packages/sdk/typescript/src/index.ts","lineNumber":860,"sourceCode":"      return `[cave-artifact id=${response.artifact_id} source=${options.source} type=${options.contentType ?? \"application/json\"}]\\nsummary: artifact stored.\\nretrieve: authenticated GET /sdk/v1/artifacts/${response.artifact_id} or trace.artifacts.get(\"${response.artifact_id}\").\\n[/cave-artifact]`;\n    },\n    get: async (artifactId: string): Promise<unknown> => artifactGet(this.cave, artifactId, this.workflow, this.traceContext())\n  };\n\n  context = {\n    checkpoint: async (messages: unknown[], options: Record<string, unknown>) => request(this.cave, \"/sdk/v1/checkpoints\", { messages, options, workflow: this.workflow }, this.workflow, this.traceContext()),\n    /**\n     * Reverse a checkpoint `source_ref` back into the original context.\n     *\n     * GETs `/sdk/v1/checkpoints/{sourceRef}/expand`; the gateway returns the\n     * stored `{ source_ref, version, messages, checkpoint }`. This is the other\n     * half of `checkpoint()` — reversibility is mandatory: a checkpoint that\n     * cannot be expanded is a bug.\n     */\n    expand: async (sourceRef: string) => {\n      const response = await request(this.cave, `/sdk/v1/checkpoints/${encodeURIComponent(sourceRef)}/expand`, undefined, this.workflow, this.traceContext());\n      if (typeof response.source_ref !== \"string\" || response.source_ref.trim() === \"\" || !Array.isArray(response.messages)) {\n        throw new CaveRequestError(200, \"/sdk/v1/checkpoints/{sourceRef}/expand\", \"cave checkpoint response missing source_ref or messages\");\n      }\n      return response;\n    }\n  };\n}\n\n// ─── Runtime policy client ────────────────────────────────────────────────────\n\n/** Schema version this client accepts; anything else is rejected (fail closed). */\nconst RUNTIME_POLICY_SCHEMA_VERSION = \"caveman.runtime-policy.v1\";\n\n/** Runtime-policy envelopes are KB-sized; stop a hostile body after 1 MiB. */\nconst RUNTIME_POLICY_MAX_RESPONSE_BYTES = 1024 * 1024;\n\nasync function readRuntimePolicyResponseText(response: Response): Promise<string> {\n  const contentLength = response.headers?.get?.(\"content-length\");\n  if (typeof contentLength === \"string\" && /^[0-9]+$/.test(contentLength) && Number(contentLength) > RUNTIME_POLICY_MAX_RESPONSE_BYTES) {\n    await Promise.resolve(response.body?.cancel?.()).catch(() => undefined);","sourceCodeStart":842,"sourceCodeEnd":878,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/sdk/typescript/src/index.ts#L842-L878","documentation":"Error \"cave checkpoint response missing source_ref or messages\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/sdk/typescript/src/index.ts:860 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The cave checkpoint response lacked source_ref or messages; verify the server version and retry."],"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-15T17:31:12.345Z"}