{"record":{"id":"3085d1e8bdeebd7d","repo":"nodejs/node","slug":"sqlitecachestore-options-maxentrysize-must-be-less","errorCode":null,"errorMessage":"SqliteCacheStore options.maxEntrySize must be less than 2gb","messagePattern":"SqliteCacheStore options\\.maxEntrySize must be less than 2gb","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"deps/undici/src/lib/cache/sqlite-cache-store.js","lineNumber":94,"sourceCode":"   * @param {import('../../types/cache-interceptor.d.ts').default.SqliteCacheStoreOpts | undefined} opts\n   */\n  constructor (opts) {\n    if (opts) {\n      if (typeof opts !== 'object') {\n        throw new TypeError('SqliteCacheStore options must be an object')\n      }\n\n      if (opts.maxEntrySize !== undefined) {\n        if (\n          typeof opts.maxEntrySize !== 'number' ||\n          !Number.isInteger(opts.maxEntrySize) ||\n          opts.maxEntrySize < 0\n        ) {\n          throw new TypeError('SqliteCacheStore options.maxEntrySize must be a non-negative integer')\n        }\n\n        if (opts.maxEntrySize > MAX_ENTRY_SIZE) {\n          throw new TypeError('SqliteCacheStore options.maxEntrySize must be less than 2gb')\n        }\n\n        this.#maxEntrySize = opts.maxEntrySize\n      }\n\n      if (opts.maxCount !== undefined) {\n        if (\n          typeof opts.maxCount !== 'number' ||\n          !Number.isInteger(opts.maxCount) ||\n          opts.maxCount < 0\n        ) {\n          throw new TypeError('SqliteCacheStore options.maxCount must be a non-negative integer')\n        }\n        this.#maxCount = opts.maxCount\n      }\n    }\n\n    if (!DatabaseSync) {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/undici/src/lib/cache/sqlite-cache-store.js#L76-L112","documentation":"Thrown when opts.maxEntrySize is a valid non-negative integer but exceeds MAX_ENTRY_SIZE (the 2 GiB ceiling). SQLite blob/page limits make entries above ~2 GB impractical, so the store refuses them up front rather than failing later on a write.","triggerScenarios":"Passing maxEntrySize larger than 2 * 1024 * 1024 * 1024 (e.g. 3e9 or 5 * 1024**3). Most common when the value was computed in MB or GB and multiplied incorrectly.","commonSituations":"Assuming the unit is megabytes; pulling a value from a shared config meant for disk cache size; copy-pasting a large CDN-style number into a single-entry cap.","solutions":["Lower the value below 2 GiB: new SqliteCacheStore({ maxEntrySize: 1024 * 1024 * 1024 }).","If you genuinely need huge entries, do not use SqliteCacheStore — pick a filesystem-backed store.","Confirm you are passing bytes, not a larger unit.","Omit the option to fall back to the default cap."],"exampleFix":"// before\nnew SqliteCacheStore({ maxEntrySize: 5 * 1024 * 1024 * 1024 })\n// after\nnew SqliteCacheStore({ maxEntrySize: 1024 * 1024 * 1024 })","handlingStrategy":"validation","validationCode":"const MAX_ENTRY_SIZE = 2 * 1024 * 1024 * 1024\nif (opts.maxEntrySize != null && opts.maxEntrySize > MAX_ENTRY_SIZE) {\n  throw new RangeError('maxEntrySize must be < 2 GiB')\n}","typeGuard":"function isWithinMaxEntrySize(v) {\n  return typeof v === 'number' && Number.isInteger(v) && v >= 0 && v <= 2 * 1024 ** 3\n}","tryCatchPattern":null,"preventionTips":["Document and enforce the 2 GiB ceiling in your config layer.","Confirm the unit is bytes before passing.","Use a filesystem store for very large bodies.","Clamp from config rather than failing at construction."],"tags":["cache","sqlite","validation","limits","undici"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}