{"record":{"id":"779c4bd5a586d362","repo":"diegosouzapw/OmniRoute","slug":"refusing-to-persist-quotawindowthresholds-with-rej","errorCode":null,"errorMessage":"Refusing to persist quotaWindowThresholds with rejected keys: ${result.rejected.join(\", \")}","messagePattern":"Refusing to persist quotaWindowThresholds with rejected keys: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/db/providers.ts","lineNumber":673,"sourceCode":"    \"healthCheckInterval\",\n  ];\n  for (const field of optionalFields) {\n    if (data[field] !== undefined && data[field] !== null) {\n      connection[field] = data[field];\n    }\n  }\n  if (normalizedProviderSpecificData && Object.keys(normalizedProviderSpecificData).length > 0) {\n    connection.providerSpecificData = normalizedProviderSpecificData;\n  }\n  // Sanitize the window-thresholds map up front so the in-memory `connection`\n  // matches the row we're about to insert. The serialize path runs the same\n  // sanitizer on the way to SQLite. Assigning null (when sanitize collapses\n  // to no-overrides) keeps the field present on the returned object so the\n  // UI can tell \"field was read, no overrides\" apart from \"field absent.\"\n  if (\"quotaWindowThresholds\" in connection) {\n    const result = sanitizeQuotaWindowThresholds(connection.quotaWindowThresholds);\n    if (result.rejected.length > 0) {\n      throw new Error(\n        `Refusing to persist quotaWindowThresholds with rejected keys: ${result.rejected.join(\", \")}`\n      );\n    }\n    connection.quotaWindowThresholds = result.sanitized;\n  }\n\n  // Same sanitization for rateLimitOverrides — keep in-memory representation\n  // in sync with what gets persisted. Reject (don't silently drop) invalid\n  // keys/values so a direct DB writer can't lose operator intent.\n  if (\"rateLimitOverrides\" in connection) {\n    const result = sanitizeRateLimitOverrides(connection.rateLimitOverrides);\n    if (result.rejected.length > 0) {\n      throw new Error(\n        `Refusing to persist rateLimitOverrides with rejected keys: ${result.rejected.join(\", \")}`\n      );\n    }\n    connection.rateLimitOverrides = result.sanitized;\n  }","sourceCodeStart":655,"sourceCodeEnd":691,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/db/providers.ts#L655-L691","documentation":"Error \"Refusing to persist quotaWindowThresholds with rejected keys: ${result.rejected.join(\", \")}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/db/providers.ts:673 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}