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/web/fetch/route.ts:271

  };
}

/** Resolve the provider + credentials to use for this request (explicit or auto-select). */
async function resolveWebFetchTarget(
  requestedProvider: string | undefined
): Promise<ResolvedWebFetchTarget> {
  if (requestedProvider) {
    return resolveExplicitTarget(requestedProvider as WebFetchProviderId);
  }
  return resolveAutoSelectTarget();
}

export async function POST(request: Request) {
  let rawBody: unknown;
  try {
    rawBody = await request.json();
  } catch {
    log.warn("WEB_FETCH", "Invalid JSON body");
    return errorResponse(HTTP_STATUS.BAD_REQUEST, "Invalid JSON body");
  }

  const validation = validateBody(v1WebFetchSchema, rawBody);
  if (isValidationFailure(validation)) {
    return errorResponse(HTTP_STATUS.BAD_REQUEST, validation.error.message);
  }
  const body = validation.data;

  // Optional 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/web/fetch/route.ts:271 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/f19884015b342aa0. Report an issue: GitHub.