diegosouzapw/OmniRoute · error · WebSearchExecutionError

Unsupported search_type

Error message

Unsupported search_type: ${String(input.search_type)}

What it means

assertValidSearchInput's enum guard: input.search_type was provided but is neither 'web', 'news', nor the third allowed literal recognized by the executor. Thrown as a 400-class validation error before any search provider is contacted — the request must resend a supported search_type or omit it.

Solutions

  1. Set search_type to one of: 'web', 'news', 'x' (or omit it to default to 'web').
  2. Fix the calling client/agent that produced an unsupported search_type value.
  3. Note that provider aliases (x-search, xquik-search) auto-force search_type 'x' — do not pass conflicting types.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/search/executeWebSearch.ts:119 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/lib/search/executeWebSearch.ts:119

      ? fromLimit
      : providerConfig.defaultMaxResults;
  return Math.min(Math.max(1, requested), providerConfig.maxMaxResults);
}

function assertValidSearchInput(input: ExecuteWebSearchInput) {
  if (typeof input.query !== "string" || input.query.trim().length === 0) {
    throw new WebSearchExecutionError("Missing required field: query", 400);
  }
  if (input.query.trim().length > 500) {
    throw new WebSearchExecutionError("Query must be 500 characters or fewer", 400);
  }
  if (
    input.search_type &&
    input.search_type !== "web" &&
    input.search_type !== "news" &&
    input.search_type !== "x"
  ) {
    throw new WebSearchExecutionError(`Unsupported search_type: ${String(input.search_type)}`, 400);
  }
}

export async function executeWebSearch(
  input: ExecuteWebSearchInput
): Promise<ExecuteWebSearchResult> {
  assertValidSearchInput(input);

  const log = input.log || defaultLog;
  if (input.provider === "x_search") input.provider = "x-search";
  if (input.provider === "xquik" || input.provider === "xquik_search") {
    input.provider = "xquik-search";
  }
  if (input.provider === "x-search" || input.provider === "xquik-search") input.search_type = "x";
  const searchType = input.search_type || "web";

  if (input.provider) {
    const explicitProvider = resolveSearchProvider(input.provider);

View on GitHub (pinned to a179ffed5b)