JuliusBrussee/caveman · error

cave_provider_raw_path_not_allowed

Error message

cave_provider_raw_path_not_allowed

What it means

Error "cave_provider_raw_path_not_allowed" thrown in JuliusBrussee/caveman.

Source

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

}

function providerClient(cave: Cave, provider: string, prefix: string, upstreamKey?: string) {
  return {
    provider,
    responses: { create: (body: unknown, init?: { cave?: { latencyClass?: string; toolSessionId?: string } }) => providerFetch(cave, `${prefix}/responses`, body, cave.options.defaultWorkflow ?? "unlabeled-workflow", init?.cave, upstreamKey) },
    chat: { completions: { create: (body: unknown, init?: { cave?: { toolSessionId?: string } }) => providerFetch(cave, `${prefix}/chat/completions`, body, cave.options.defaultWorkflow ?? "unlabeled-workflow", init?.cave, upstreamKey) } },
    raw: (input: RequestInfo | URL, init?: RequestInit) => providerRawFetch(cave, prefix, input, init, upstreamKey)
  };
}

function providerRawFetch(cave: Cave, prefix: string, input: RequestInfo | URL, init?: RequestInit, upstreamKey?: string): Promise<Response> {
  const base = new URL(cave.options.baseURL);
  const request = input instanceof Request
    ? new Request(input, init)
    : new Request(new URL(String(input), base), init);
  const target = new URL(request.url);
  if (target.origin !== base.origin || (target.pathname !== prefix && !target.pathname.startsWith(`${prefix}/`))) {
    throw new Error("cave_provider_raw_path_not_allowed");
  }
  const merged = new Headers(request.headers);
  const gatewayHeaders = headers(cave, cave.options.defaultWorkflow ?? "unlabeled-workflow", upstreamKey);
  for (const [name, value] of Object.entries(gatewayHeaders)) {
    if (name !== "content-type") merged.set(name, value);
  }
  return caveFetch(cave, new Request(request, { headers: merged }));
}

async function providerFetch(cave: Cave, path: string, body: unknown, workflow: string, hint?: Record<string, unknown>, upstreamKey?: string, trace?: TraceContext) {
  const assemblyHeader = body !== null && typeof body === "object" ? assemblyRequestHeaders.get(body as object) : undefined;
  const response = await caveFetch(cave, `${cave.options.baseURL}${path}`, {
    method: "POST",
    headers: headers(cave, workflow, upstreamKey, assemblyHeader ? { ...hint, assemblyHeader } : hint, trace),
    body: JSON.stringify(body)
  });
  if (!response.ok) throw new Error(await response.text());
  return response.json();

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Raw provider paths are not allowed through cave; use the supported request path.

When it happens

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