{"record":{"id":"fbca170a0c255798","repo":"diegosouzapw/OmniRoute","slug":"cache-size-must-be-a-positive-kib-value-between-1","errorCode":null,"errorMessage":"cache_size must be a positive KiB value between 1 and 1000000","messagePattern":"cache_size must be a positive KiB value between 1 and 1000000","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/db/optimizationSettings.ts","lineNumber":64,"sourceCode":"}\n\nfunction normalizeVacuumHour(value: unknown, fallback: number): number {\n  const numeric = Number(value);\n  if (!Number.isFinite(numeric)) return fallback;\n  return Math.min(23, Math.max(0, Math.floor(numeric)));\n}\n\nfunction normalizeStoredCacheSizeKb(value: unknown, fallback: number): number {\n  const numeric = Number(value);\n  if (!Number.isFinite(numeric)) return fallback;\n  const cacheSizeKb = Math.floor(numeric);\n  if (cacheSizeKb < 1 || cacheSizeKb > 1000000) return fallback;\n  return cacheSizeKb;\n}\n\nfunction requireCacheSizeKb(value: number): number {\n  if (!Number.isInteger(value) || value < 1 || value > 1000000) {\n    throw new Error(\"cache_size must be a positive KiB value between 1 and 1000000\");\n  }\n  return value;\n}\n\nfunction mergeOptimizationSettings(\n  target: DatabaseOptimizationSettings,\n  value: unknown\n): DatabaseOptimizationSettings {\n  if (!isRecord(value)) return target;\n  return {\n    ...target,\n    autoVacuumMode: normalizeAutoVacuumMode(value.autoVacuumMode, target.autoVacuumMode),\n    scheduledVacuum:\n      typeof value.scheduledVacuum === \"string\" &&\n      [\"never\", \"daily\", \"weekly\", \"monthly\"].includes(value.scheduledVacuum)\n        ? (value.scheduledVacuum as DatabaseOptimizationSettings[\"scheduledVacuum\"])\n        : target.scheduledVacuum,\n    vacuumHour: normalizeVacuumHour(value.vacuumHour, target.vacuumHour),","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/db/optimizationSettings.ts#L46-L82","documentation":"Error \"cache_size must be a positive KiB value between 1 and 1000000\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/db/optimizationSettings.ts:64 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"}