JuliusBrussee/caveman · error · CaveRequestError
cave response must be a JSON object
Error message
cave response must be a JSON object
What it means
Error "cave response must be a JSON object" thrown in JuliusBrussee/caveman.
Source
Thrown at packages/sdk/typescript/src/index.ts:2071
headers: { ...headers(cave, workflow ?? cave.options.defaultWorkflow ?? "unlabeled-workflow", undefined, undefined, trace), ...extraHeaders }
};
if (body !== undefined) init.body = JSON.stringify(body);
const response = await caveFetch(cave, `${cave.options.baseURL}${path}`, init);
if (!response.ok) throw new CaveRequestError(response.status, path, `cave request failed (${response.status})`);
let decoded: unknown;
try {
if (typeof response.text === "function") {
decoded = JSON.parse(await response.text());
} else if (typeof response.json === "function") {
decoded = await response.json();
} else {
throw new Error("missing response decoder");
}
} catch {
throw new CaveRequestError(response.status, path, "cave response was not valid JSON");
}
if (decoded === null || typeof decoded !== "object" || Array.isArray(decoded)) {
throw new CaveRequestError(response.status, path, "cave response must be a JSON object");
}
return decoded as Record<string, unknown>;
}
async function artifactGet(cave: Cave, artifactId: string, workflow: string, trace: TraceContext): Promise<unknown> {
if (typeof artifactId !== "string" || artifactId.trim() === "") throw new Error("artifactId is required");
const path = `/sdk/v1/artifacts/${encodeURIComponent(artifactId)}`;
const response = await caveFetch(cave, `${cave.options.baseURL}${path}`, {
method: "GET",
headers: headers(cave, workflow, undefined, undefined, trace)
});
if (!response.ok) throw new CaveRequestError(response.status, path, `cave request failed (${response.status})`);
try {
return JSON.parse(await response.text());
} catch {
throw new CaveRequestError(response.status, path, "cave artifact was not valid JSON");
}
}View on GitHub (pinned to 27d5a3981a)
Solutions
- The cave response must be a JSON object; verify the server response shape.
When it happens
Trigger: Thrown at packages/sdk/typescript/src/index.ts:2071 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/44e697f599351214.
Report an issue: GitHub.