diegosouzapw/OmniRoute · error · Error

err.error || t("requestFailed", )

Error message

err.error || t("requestFailed", { status: res.status })

What it means

executeTryIt's POST to /api/openapi/try (method/path/headers/body) returned non-OK; the thrown message prefers the body's err.error string over the localized requestFailed fallback with the status. The parsed try-body was already JSON.parse'd upstream, so malformed input fails before this point.

Solutions

  1. Inspect err.error for the upstream failure detail
  2. Validate that tryBody parses as JSON before sending
  3. Check server logs for the proxied call
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/endpoint/ApiEndpointsTab.tsx:296 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/a51e0311cceee428. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/endpoint/ApiEndpointsTab.tsx:296

        } else {
          throw new Error(t("apiKeyRequired"));
        }
      }

      const res = await fetch("/api/openapi/try", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          method: ep.method,
          path: ep.path,
          headers,
          body: tryBody ? JSON.parse(tryBody) : undefined,
        }),
      });
      if (res.ok) setTryResult(await res.json());
      else {
        const err = await res.json().catch(() => ({}));
        throw new Error(err.error || t("requestFailed", { status: res.status }));
      }
    } catch (err: any) {
      setTryResult({
        status: 0,
        statusText: t("errorStatus"),
        headers: {},
        body: { error: err.message },
        latencyMs: 0,
        contentType: "application/json",
      });
    }
    setTrying(false);
  };

  if (loading) {
    return (
      <div className="animate-pulse space-y-4">
        <div className="h-8 bg-white/5 rounded-lg w-1/3" />

View on GitHub (pinned to a179ffed5b)