diegosouzapw/OmniRoute · error · Error

(await readErrorMessage(response)) ?? t("tomlImportError")

Error message

(await readErrorMessage(response)) ?? t("tomlImportError")

What it means

Error "(await readErrorMessage(response)) ?? t("tomlImportError")" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/app/(dashboard)/dashboard/context/rtk/RtkTomlImportCard.tsx:198

  const t = useTranslations("contextRtk");
  const [content, setContent] = useState("");
  const [result, setResult] = useState<ImportResult | null>(null);
  const [error, setError] = useState<string | null>(null);
  const [processing, setProcessing] = useState<"validate" | "install" | null>(null);
  const [overwrite, setOverwrite] = useState(false);

  async function processImport(action: "validate" | "install") {
    if (!content.trim()) return;
    setProcessing(action);
    setError(null);
    try {
      const response = await fetch("/api/context/rtk/import", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ action, content, overwrite: action === "install" && overwrite }),
      });
      if (!response.ok) {
        throw new Error((await readErrorMessage(response)) ?? t("tomlImportError"));
      }
      const nextResult = (await response.json()) as ImportResult;
      setResult(nextResult);
      if (action === "install") await onInstalled?.();
    } catch (caught) {
      setResult(null);
      setError(caught instanceof Error ? caught.message : t("tomlImportError"));
    } finally {
      setProcessing(null);
    }
  }

  async function loadFile(file: File | undefined) {
    if (!file) return;
    setError(null);
    if (file.size > RTK_TOML_MAX_BYTES) {
      setError(t("tomlFileReadError"));
      return;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/context/rtk/RtkTomlImportCard.tsx:198 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/041687923713c793. Report an issue: GitHub.