diegosouzapw/OmniRoute · error

cache_size change did not take effect (expected ${targetCach

Error message

cache_size change did not take effect (expected ${targetCacheSize}, got ${newCacheSize})

What it means

Error "cache_size change did not take effect (expected ${targetCacheSize}, got ${newCacheSize})" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/db/optimizationSettings.ts:165

export function setCacheSizeForDb(db: SqliteDatabase, cacheSizeKb: number): void {
  const normalizedCacheSizeKb = requireCacheSizeKb(cacheSizeKb);
  const currentCacheSize = db.pragma("cache_size", { simple: true }) as number;
  const targetCacheSize = -normalizedCacheSizeKb;

  if (currentCacheSize === targetCacheSize) {
    console.log(`[DB] cache_size already set to ${normalizedCacheSizeKb}KB`);
    return;
  }

  console.log(
    `[DB] Changing cache_size from ${Math.abs(currentCacheSize)}KB to ${normalizedCacheSizeKb}KB`
  );
  db.pragma(`cache_size = ${targetCacheSize}`);

  const newCacheSize = db.pragma("cache_size", { simple: true }) as number;
  if (newCacheSize !== targetCacheSize) {
    throw new Error(
      `cache_size change did not take effect (expected ${targetCacheSize}, got ${newCacheSize})`
    );
  }
  console.log(`[DB] cache_size changed to ${Math.abs(newCacheSize)}KB`);
}

function applyPersistentOptimizationPragmas(
  db: SqliteDatabase,
  settings: DatabaseOptimizationSettings
): void {
  const targetAutoVacuum = AUTO_VACUUM_MODE_TO_PRAGMA[settings.autoVacuumMode];
  const targetPageSize = normalizePageSizeBytes(
    settings.pageSize,
    DEFAULT_DATABASE_SETTINGS.optimization.pageSize
  );
  const currentAutoVacuum = db.pragma("auto_vacuum", { simple: true }) as number;
  const currentPageSize = db.pragma("page_size", { simple: true }) as number;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/db/optimizationSettings.ts:165 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/dec90cf0a1d3c4f2. Report an issue: GitHub.