diegosouzapw/OmniRoute · error · Error

data.error?.message || data.error || "Failed to reorder…

Error message

data.error?.message || data.error || "Failed to reorder combos"

What it means

The combo drag-reorder's POST to /api/combos/reorder with the optimistic comboIds order returned non-OK; message prefers data.error.message/data.error over 'Failed to reorder combos'. The UI already applied the new order optimistically — the catch must rely on this throw to know a rollback is needed.

Solutions

  1. Verify the catch path rolls back to previousCombos
  2. Validate the comboIds payload matches the server contract
  3. Check server logs for the failing reorder
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/combos/page.tsx:1073 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/429d4de75e494ecc. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/combos/page.tsx:1073

    resetComboDragState();

    if (fromIndex === null || fromIndex === dropIndex) return;

    const previousCombos = combos;
    const nextCombos = moveArrayItem(combos, fromIndex, dropIndex);
    setCombos(nextCombos);
    setSavingComboOrder(true);

    try {
      const res = await fetch("/api/combos/reorder", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ comboIds: nextCombos.map((combo) => combo.id) }),
      });
      const data = await res.json();

      if (!res.ok) {
        throw new Error(data.error?.message || data.error || "Failed to reorder combos");
      }

      if (Array.isArray(data.combos)) {
        setCombos(data.combos);
      }
    } catch {
      setCombos(previousCombos);
      notify.error(getI18nOrFallback(t, "failedReorder", "Failed to save combo order"));
    } finally {
      setSavingComboOrder(false);
    }
  };

  if (loading) {
    return (
      <div className="flex flex-col gap-6">
        <CardSkeleton />
        <CardSkeleton />

View on GitHub (pinned to a179ffed5b)