{"record":{"id":"bcad0b84330d4a17","repo":"JuliusBrussee/caveman","slug":"cave-artifact-response-missing-artifact-id","errorCode":null,"errorMessage":"cave artifact response missing artifact_id","messagePattern":"cave artifact response missing artifact_id","errorType":"exception","errorClass":"CaveRequestError","httpStatus":200,"severity":"error","filePath":"packages/sdk/typescript/src/index.ts","lineNumber":840,"sourceCode":"  }\n\n  model = {\n    openai: {\n      responses: { create: (body: unknown, init?: { cave?: { latencyClass?: string } }) => providerFetch(this.cave, \"/openai/v1/responses\", body, this.workflow, init?.cave, undefined, this.traceContext()) },\n      chat: { completions: { create: (body: unknown) => providerFetch(this.cave, \"/openai/v1/chat/completions\", body, this.workflow, undefined, undefined, this.traceContext()) } }\n    }\n  };\n\n  artifacts = {\n    page: async (value: unknown, options: { source: string; contentType?: string; strategy: \"verbatim\" | \"json-index\" | \"text-chunks\" | \"table-index\" | \"llm-summary\"; maxInlineTokens?: number }) => {\n      if (options.strategy === \"verbatim\") return value;\n      const response = await request(this.cave, \"/sdk/v1/artifacts\", { value, options, workflow: this.workflow }, this.workflow, this.traceContext(), {\n        \"x-cave-artifact-envelope\": \"value-v1\",\n        \"x-cave-artifact-source\": options.source\n      });\n      if (response.stored === false) return value;\n      if (response.stored !== true || typeof response.artifact_id !== \"string\" || response.artifact_id.trim() === \"\") {\n        throw new CaveRequestError(200, \"/sdk/v1/artifacts\", \"cave artifact response missing artifact_id\");\n      }\n      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());","sourceCodeStart":822,"sourceCodeEnd":858,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/sdk/typescript/src/index.ts#L822-L858","documentation":"Error \"cave artifact response missing artifact_id\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/sdk/typescript/src/index.ts:840 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The cave artifact response lacked artifact_id; 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-15T22:17:37.221Z"}