JuliusBrussee/caveman · error
cave_provider_raw_path_not_allowed
cave_provider_raw_path_not_allowed
Error message
cave_provider_raw_path_not_allowed
What it means
Security guard in the SDK raw provider-request path: the Request URL does not match the configured provider prefix (same origin, pathname equal to or under the prefix). Raw passthrough is only permitted to the mounted provider route, so anything else is refused before the request leaves the SDK.
Solutions
- Point the Request at the same path you would pass to providerClient (e.g. <prefix>/responses or <prefix>/chat/completions)
- Use the structured responses/chat client instead of raw Request passthrough
- Fix the baseURL or prefix configuration so origins match
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/sdk/typescript/src/index.ts:2086 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/8f4c30bf373545e8.
Report an issue: GitHub.
Appendix: source
Thrown at packages/sdk/typescript/src/index.ts:2086
}
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 3ee70a1026)