diegosouzapw/OmniRoute · error · Error

Programmable Search Engine ID (cx) is required

Error message

Programmable Search Engine ID (cx) is required

What it means

Validation guard in the provider search-key test request builder: the google-pse-search provider was selected but its providerSpecificData.cx (Programmable Search Engine ID) is empty/undefined, so the probe request cannot be constructed and the caller throws this error before any network call. It is a required-configuration sentinel, not a network failure.

Solutions

  1. Create a Programmable Search Engine at programmablesearchengine.google.com and copy its cx into the provider's settings.
  2. Ensure the cx value is passed in providerSpecificData when saving/testing the connection.
  3. Re-run the connection test after adding cx.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/providers/validation/searchProviders.ts:90 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/f013607c355c7af3. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/providers/validation/searchProviders.ts:90

  "tavily-search": (apiKey) => ({
    url: "https://api.tavily.com/search",
    init: {
      method: "POST",
      headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
      body: JSON.stringify({ query: "test", max_results: 1 }),
    },
  }),
  context7: (apiKey) => ({
    url: "https://context7.com/api/v1/search?query=test",
    init: {
      method: "GET",
      headers: { Accept: "application/json", Authorization: `Bearer ${apiKey}` },
    },
  }),
  "google-pse-search": (apiKey, providerSpecificData = {}) => {
    const cx = providerSpecificData?.cx;
    if (!cx || typeof cx !== "string") {
      throw new Error("Programmable Search Engine ID (cx) is required");
    }
    return {
      url: `https://www.googleapis.com/customsearch/v1?key=${encodeURIComponent(apiKey)}&cx=${encodeURIComponent(
        cx
      )}&q=test&num=1`,
      init: {
        method: "GET",
        headers: { Accept: "application/json" },
      },
    };
  },
  "linkup-search": (apiKey) => ({
    url: "https://api.linkup.so/v1/search",
    init: {
      method: "POST",
      headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
      body: JSON.stringify({
        q: "test",

View on GitHub (pinned to a179ffed5b)