diegosouzapw/OmniRoute · error
Invalid JSON body
Error message
Invalid JSON body
What it means
Error "Invalid JSON body" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/app/api/v1/embeddings/route.ts:47
(model) => model.type === "embedding"
);
}
type ValidatedEmbeddingBody = Record<string, unknown> & { model: string };
export async function handleValidatedEmbeddingRequestBody(
body: ValidatedEmbeddingBody,
options: EmbeddingHandlerOptions = {}
) {
return createEmbeddingResponse(body, options);
}
async function postHandler(request, context) {
let rawBody;
try {
rawBody = await request.json();
} catch {
log.warn("EMBED", "Invalid JSON body");
return errorResponse(HTTP_STATUS.BAD_REQUEST, "Invalid JSON body");
}
const validation = validateBody(v1EmbeddingsSchema, rawBody);
if (isValidationFailure(validation)) {
return errorResponse(HTTP_STATUS.BAD_REQUEST, validation.error.message);
}
const body = validation.data;
// Auth check — when REQUIRE_API_KEY=false, ignore presented invalid keys
// so anonymous access works the same as all other client APIs (#7785).
const apiKeyRaw = extractApiKey(request);
if (isRequireApiKeyEnabled() && !apiKeyRaw) {
return errorResponse(HTTP_STATUS.UNAUTHORIZED, "Authentication required");
}
if (isRequireApiKeyEnabled() && apiKeyRaw && !(await isValidApiKey(apiKeyRaw))) {
return errorResponse(HTTP_STATUS.UNAUTHORIZED, "Invalid API key");
}View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/app/api/v1/embeddings/route.ts:47 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/70c0ca0296429917.
Report an issue: GitHub.