diegosouzapw/OmniRoute · error · Error

Failed to restore backup

Error message

Failed to restore backup

What it means

restoreBackup's POST to /api/cli-tools/backups (restore a saved Grok Build config snapshot) returned non-OK; the fallback message is 'Failed to restore backup'. Fires when the backup id is unknown/stale or the restore write fails; the card keeps the error until the next successful action.

Solutions

  1. Confirm the backupId still exists before attempting restore
  2. Surface the server error body text
  3. Check server logs for the restore handler
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/cli-code/components/GrokBuildToolCard.tsx:336 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/3155f4df82c3e8f4. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/cli-code/components/GrokBuildToolCard.tsx:336

  const selectModel = (selection: unknown) => {
    const value = (selection as { value?: unknown })?.value;
    if (typeof value !== "string") return;
    if (modelTarget === "main") setModel(value);
    else if (modelTarget) setSubagentModels((current) => ({ ...current, [modelTarget]: value }));
    setModelTarget(null);
  };

  const restoreBackup = async (backupId: string) => {
    setRestoringBackup(backupId);
    setMessage(null);
    try {
      const response = await fetch("/api/cli-tools/backups", {
        method: "POST",
        headers: { "content-type": "application/json" },
        body: JSON.stringify({ tool: "grok-build", backupId }),
      });
      const body: unknown = await response.json();
      if (!response.ok) throw new Error(errorText(body, "Failed to restore backup"));
      setMessage({ type: "success", text: "Grok Build backup restored." });
      await Promise.all([refreshStatus(), refreshBackups()]);
    } catch (error) {
      setMessage({ type: "error", text: error instanceof Error ? error.message : String(error) });
    } finally {
      setRestoringBackup(null);
    }
  };

  const configured = Boolean(status?.hasOmniRoute);
  const cliReady = Boolean(status?.installed && status?.runnable);
  const effectiveConfigStatus = status
    ? cliReady
      ? configured
        ? "configured"
        : "not_configured"
      : "not_installed"
    : (batchStatus?.config.status ?? null);

View on GitHub (pinned to a179ffed5b)