{"record":{"id":"228879fc087a6fc7","repo":"influxdata/influxdb","slug":"last-cache-size-must-be-greater-than-0","errorCode":null,"errorMessage":"last cache size must be greater than 0","messagePattern":"last cache size must be greater than 0","errorType":"validation","errorClass":"CatalogError","httpStatus":null,"severity":"error","filePath":"influxdb3_catalog/src/error.rs","lineNumber":267,"sourceCode":"    },\n\n    #[error(\"Processing Engine Unimplemented: {}\", feature_description)]\n    ProcessingEngineUnimplemented { feature_description: String },\n\n    #[error(\n        \"Processing Engine Trigger {} not in DB {}\",\n        trigger_name,\n        database_name\n    )]\n    ProcessingEngineTriggerNotFound {\n        database_name: String,\n        trigger_name: String,\n    },\n\n    #[error(\"failed to parse trigger from {}\", trigger_spec)]\n    ProcessingEngineTriggerSpecParseError { trigger_spec: String },\n\n    #[error(\"last cache size must be greater than 0\")]\n    InvalidLastCacheSize,\n\n    #[error(\"failed to parse trigger from {trigger_spec}{}\", .context.as_ref().map(|context| format!(\": {context}\")).unwrap_or_default())]\n    TriggerSpecificationParseError {\n        trigger_spec: String,\n        context: Option<String>,\n    },\n\n    #[error(\"invalid error behavior {0}\")]\n    InvalidErrorBehavior(String),\n\n    #[error(\"cannot parse token permission, {0}\")]\n    CannotParsePermissionForToken(String),\n\n    #[error(\"token name already exists, {0}\")]\n    TokenNameAlreadyExists(String),\n\n    #[error(\"token hash already exists\")]","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/error.rs#L249-L285","documentation":"A last-n-cache (LastCache) was created with a size parameter of zero or less. The catalog requires the cache size (number of entries/values to retain) to be a positive integer, and throws InvalidLastCacheSize otherwise.","triggerScenarios":"Calling the last cache creation API (ADD LAST CACHE / catalog add_last_cache) with a size value of 0 or a negative number.","commonSituations":"Computing the cache size from config/env where the variable defaulted to 0; off-by-one or unset CLI flag leading to size=0; template expansion that left the size placeholder empty.","solutions":["Pass a positive integer for the cache size (e.g. --size 10).","If size comes from configuration, add validation/defaulting so unset values fall back to a sensible positive default.","Omit the size option entirely if you want the server's default cache size."],"exampleFix":"// before\nCREATE LAST CACHE ON mydb mytable SIZE 0;\n// after\nCREATE LAST CACHE ON mydb mytable SIZE 10;","handlingStrategy":"validation","validationCode":"// Clamp/default the size before creating a last cache\nconst size = Number.parseInt(cfg.lastCacheSize, 10);\nif (!Number.isInteger(size) || size <= 0) {\n  throw new Error(`last cache size must be > 0, got ${cfg.lastCacheSize}`);\n}\nawait client.createLastCache(db, table, { size });","typeGuard":"function isValidCacheSize(v) {\n  return Number.isInteger(v) && v > 0;\n}","tryCatchPattern":"try {\n  await createLastCache(db, table, { size });\n} catch (e) {\n  if (String(e).includes('last cache size must be greater than 0')) {\n    await createLastCache(db, table, { size: 10 }); // documented default\n  } else throw e;\n}","preventionTips":["Validate cache size config at startup, not at first use","Default unset size values to a positive server default","Add range checks wherever size is computed from user input"],"tags":["last-cache","influxdb","argument-validation"],"backgroundTag":"value-out-of-range","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}