diegosouzapw/OmniRoute · error · Error

message (parseApiError result)

Error message

message (parseApiError result)

What it means

MediaPageClient's speech/TTS submit got a non-OK from config.endpoint and parsed the JSON body with parseApiError; the thrown message is whatever that helper resolved — server error text, or the localized requestFailed fallback with the status. isCredentials from the same parse drives a separate credentials-expired UI branch.

Solutions

  1. Check upstream provider credentials when parseApiError sets isCredentials
  2. Inspect res.status and the parsed message for the real cause
  3. Retry transient upstream failures before surfacing the error
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/cache/media/MediaPageClient.tsx:566 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/b22a2efbf00a8d70. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/cache/media/MediaPageClient.tsx:566

        const res = await fetch(config.endpoint, {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({
            model: modelId,
            input: promptValue,
            voice: speechVoice,
            response_format: speechFormat,
          }),
        });
        if (!res.ok) {
          const raw = await res.json().catch(() => ({}));
          const { message, isCredentials } = parseApiError(
            raw,
            res.status,
            t("requestFailed", { status: res.status })
          );
          setIsCredentialsError(isCredentials);
          throw new Error(message);
        }
        const blob = await res.blob();
        const audioUrl = URL.createObjectURL(blob);
        setResult({
          type: "speech",
          data: { format: speechFormat },
          timestamp: Date.now(),
          audioUrl,
        });
        setLoading(false);
        return;
      }

      if (activeTab === "transcription") {
        if (!audioFile) {
          setError(t("selectAudioToTranscribe"));
          setLoading(false);
          return;

View on GitHub (pinned to a179ffed5b)