{"record":{"id":"2d9c5f8faa826f15","repo":"diegosouzapw/OmniRoute","slug":"query-must-be-500-characters-or-fewer","errorCode":null,"errorMessage":"Query must be 500 characters or fewer","messagePattern":"Query must be 500 characters or fewer","errorType":"validation","errorClass":"WebSearchExecutionError","httpStatus":400,"severity":"error","filePath":"src/lib/search/executeWebSearch.ts","lineNumber":111,"sourceCode":"    typeof input.limit === \"number\"\n      ? input.limit\n      : typeof input.limit === \"string\"\n        ? Number(input.limit)\n        : Number.NaN;\n  const requested = Number.isFinite(fromMaxResults)\n    ? fromMaxResults\n    : Number.isFinite(fromLimit)\n      ? fromLimit\n      : providerConfig.defaultMaxResults;\n  return Math.min(Math.max(1, requested), providerConfig.maxMaxResults);\n}\n\nfunction assertValidSearchInput(input: ExecuteWebSearchInput) {\n  if (typeof input.query !== \"string\" || input.query.trim().length === 0) {\n    throw new WebSearchExecutionError(\"Missing required field: query\", 400);\n  }\n  if (input.query.trim().length > 500) {\n    throw new WebSearchExecutionError(\"Query must be 500 characters or fewer\", 400);\n  }\n  if (\n    input.search_type &&\n    input.search_type !== \"web\" &&\n    input.search_type !== \"news\" &&\n    input.search_type !== \"x\"\n  ) {\n    throw new WebSearchExecutionError(`Unsupported search_type: ${String(input.search_type)}`, 400);\n  }\n}\n\nexport async function executeWebSearch(\n  input: ExecuteWebSearchInput\n): Promise<ExecuteWebSearchResult> {\n  assertValidSearchInput(input);\n\n  const log = input.log || defaultLog;\n  if (input.provider === \"x_search\") input.provider = \"x-search\";","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/search/executeWebSearch.ts#L93-L129","documentation":"Error \"Query must be 500 characters or fewer\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/search/executeWebSearch.ts:111 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"}