diegosouzapw/OmniRoute · error

[HOT_RELOAD] Failed to parse persisted settings field

Error message

[HOT_RELOAD] Failed to parse persisted settings field "${field}":

What it means

A persisted settings field stored as a JSON string failed JSON.parse — the raw DB value is corrupted or was written in a non-JSON format. The parse helper falls back to returning the raw string value so the caller's own normalization/defaults take over; the field is effectively treated as unset or invalid.

Solutions

  1. Identify the affected settings field from the log
  2. Reset the field to a valid value via the settings API/dashboard
  3. Check for older writes that serialized the field incorrectly
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/lib/config/runtimeSettings.ts:127 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/4879c41d54ab1852. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/config/runtimeSettings.ts:127

  if (value && typeof value === "object") {
    return Object.fromEntries(
      Object.keys(value as JsonRecord)
        .sort((left, right) => left.localeCompare(right))
        .map((key) => [key, canonicalize((value as JsonRecord)[key])])
    );
  }

  return value;
}

function parseStoredJson(value: unknown, field: string): unknown {
  if (typeof value !== "string") return value;

  try {
    return JSON.parse(value);
  } catch (error) {
    console.warn(
      `[HOT_RELOAD] Failed to parse persisted settings field "${field}":`,
      error instanceof Error ? error.message : error
    );
    return null;
  }
}

function normalizeStringArray(value: unknown): string[] {
  if (!Array.isArray(value)) return [];

  return Array.from(
    new Set(
      value
        .map((entry) => (typeof entry === "string" ? entry.trim() : ""))
        .filter((entry) => entry.length > 0)
    )
  );
}

View on GitHub (pinned to a179ffed5b)