{"record":{"id":"f19884015b342aa0","repo":"diegosouzapw/OmniRoute","slug":"invalid-json-body-f19884","errorCode":null,"errorMessage":"Invalid JSON body","messagePattern":"Invalid JSON body","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/app/api/v1/web/fetch/route.ts","lineNumber":271,"sourceCode":"  };\n}\n\n/** Resolve the provider + credentials to use for this request (explicit or auto-select). */\nasync function resolveWebFetchTarget(\n  requestedProvider: string | undefined\n): Promise<ResolvedWebFetchTarget> {\n  if (requestedProvider) {\n    return resolveExplicitTarget(requestedProvider as WebFetchProviderId);\n  }\n  return resolveAutoSelectTarget();\n}\n\nexport async function POST(request: Request) {\n  let rawBody: unknown;\n  try {\n    rawBody = await request.json();\n  } catch {\n    log.warn(\"WEB_FETCH\", \"Invalid JSON body\");\n    return errorResponse(HTTP_STATUS.BAD_REQUEST, \"Invalid JSON body\");\n  }\n\n  const validation = validateBody(v1WebFetchSchema, rawBody);\n  if (isValidationFailure(validation)) {\n    return errorResponse(HTTP_STATUS.BAD_REQUEST, validation.error.message);\n  }\n  const body = validation.data;\n\n  // Optional auth check — when REQUIRE_API_KEY=false, ignore presented\n  // invalid keys so anonymous access works the same as all other client\n  // APIs (#7785).\n  const apiKeyRaw = extractApiKey(request);\n  if (isRequireApiKeyEnabled() && !apiKeyRaw) {\n    return errorResponse(HTTP_STATUS.UNAUTHORIZED, \"Authentication required\");\n  }\n  if (isRequireApiKeyEnabled() && apiKeyRaw && !(await isValidApiKey(apiKeyRaw))) {\n    return errorResponse(HTTP_STATUS.UNAUTHORIZED, \"Invalid API key\");","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/api/v1/web/fetch/route.ts#L253-L289","documentation":"Error \"Invalid JSON body\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/app/api/v1/web/fetch/route.ts:271 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}