diegosouzapw/OmniRoute · error · Error

errorBody?.error?.message || errorBody?.error || "Failed to…

Error message

errorBody?.error?.message || errorBody?.error || "Failed to update mode pack"

What it means

handleModePackChange's PUT to /api/combos/<id> (config.modePack swap) returned non-OK; the thrown message prefers errorBody.error.message, then errorBody.error, then the literal 'Failed to update mode pack'. savingModePack is cleared in finally, so only the inline error reflects the failure.

Solutions

  1. Validate that modePackId exists and is assignable to the combo
  2. Surface the server error message to the user
  3. Check server logs for the failing PUT
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/app/(dashboard)/dashboard/combos/IntelligentComboPanel.tsx:94 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/e5fd1bea6f01eb9b. Report an issue: GitHub.

Appendix: source

Thrown at src/app/(dashboard)/dashboard/combos/IntelligentComboPanel.tsx:94

  const handleModePackChange = async (modePackId: string) => {
    if (!combo?.id || modePackId === normalizedConfig.modePack) return;
    setSavingModePack(modePackId);

    try {
      const response = await fetch(`/api/combos/${combo.id}`, {
        method: "PUT",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          config: {
            ...(combo?.config || {}),
            modePack: modePackId,
          },
        }),
      });

      if (!response.ok) {
        const errorBody = await response.json().catch(() => null);
        throw new Error(
          errorBody?.error?.message || errorBody?.error || "Failed to update mode pack"
        );
      }

      const updatedCombo = await response.json();
      onComboUpdated?.(updatedCombo);
      notify.success(
        getI18nOrFallback(t, "modePackUpdated", "Mode pack updated to {pack}.", {
          pack: modePackId,
        }).replace("{pack}", modePackId)
      );
    } catch (error: any) {
      notify.error(error?.message || "Failed to update mode pack.");
    } finally {
      setSavingModePack(null);
    }
  };

View on GitHub (pinned to a179ffed5b)