diegosouzapw/OmniRoute · error

[HOT_RELOAD] Failed to apply runtime settings after update:

Error message

[HOT_RELOAD] Failed to apply runtime settings after update:

What it means

After settings were persisted and the settings revision bumped, applying the new runtime settings via applyRuntimeSettings (hot reload) threw. The DB now holds the new values but the running process still operates on the old runtime configuration until a later hot-reload check or restart applies them.

Solutions

  1. Check the logged error to find the setting that failed to apply
  2. Trigger another settings save or wait for the next hot-reload poll
  3. Restart the server to force a full settings reload if inconsistent
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/lib/db/settings.ts:341 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/2ef8b7b1bd0f749a. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/db/settings.ts:341

    insert.run(SETTINGS_REVISION_KEY, JSON.stringify(currentRevision + 1));
  });
  tx();
  backupDbFile("pre-write");
  invalidateDbCache("settings"); // Bust the read cache immediately

  // Bust proxy resolution cache when proxy toggle settings change
  const PROXY_TOGGLE_KEYS = ["proxyEnabled", "perKeyProxyEnabled"];
  if (Object.keys(updates).some((k) => PROXY_TOGGLE_KEYS.includes(k))) {
    bumpProxyConfigGeneration();
  }

  const nextSettings = await getSettings();

  try {
    const { applyRuntimeSettings } = await import("@/lib/config/runtimeSettings");
    await applyRuntimeSettings(nextSettings, { source: "settings:update" });
  } catch (error) {
    console.warn(
      "[HOT_RELOAD] Failed to apply runtime settings after update:",
      error instanceof Error ? error.message : error
    );
  }

  // Onboarding / setup finished → one-shot Codex catalog revalidation (init case).
  if (setupJustCompleted) {
    void import("@/shared/services/codexCatalogRevalidation")
      .then(({ scheduleCodexCatalogRevalidationAfterInit }) => {
        scheduleCodexCatalogRevalidationAfterInit();
      })
      .catch(() => {
        // non-fatal
      });
  }

  return nextSettings;
}

View on GitHub (pinned to a179ffed5b)