JuliusBrussee/caveman · error · CaveRequestError

cave request failed (${response.status})

Error message

cave request failed (${response.status})

What it means

Error "cave request failed (${response.status})" thrown in JuliusBrussee/caveman.

Source

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

  if (!response.ok) throw new Error(await response.text());
  return response.json();
}

export class CaveRequestError extends Error {
  constructor(readonly status: number, readonly path: string, message: string) {
    super(message);
    this.name = "CaveRequestError";
  }
}

async function request(cave: Cave, path: string, body?: unknown, workflow?: string, trace?: TraceContext, extraHeaders?: Record<string, string>): Promise<Record<string, unknown>> {
  const init: RequestInit = {
    method: body === undefined ? "GET" : "POST",
    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>;
}

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. The cave request failed; inspect the HTTP status, fix the request or credentials, and retry.

When it happens

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