influxdata/influxdb · error · CatalogError
last cache size must be greater than 0
Error message
last cache size must be greater than 0
What it means
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.
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.
Example fix
// before CREATE LAST CACHE ON mydb mytable SIZE 0; // after CREATE LAST CACHE ON mydb mytable SIZE 10;
Defensive patterns
Strategy: validation
Validate before calling
// Clamp/default the size before creating a last cache
const size = Number.parseInt(cfg.lastCacheSize, 10);
if (!Number.isInteger(size) || size <= 0) {
throw new Error(`last cache size must be > 0, got ${cfg.lastCacheSize}`);
}
await client.createLastCache(db, table, { size }); Type guard
function isValidCacheSize(v) {
return Number.isInteger(v) && v > 0;
} Try / catch
try {
await createLastCache(db, table, { size });
} catch (e) {
if (String(e).includes('last cache size must be greater than 0')) {
await createLastCache(db, table, { size: 10 }); // documented default
} else throw e;
} Prevention
- 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
When it happens
Trigger: Calling the last cache creation API (ADD LAST CACHE / catalog add_last_cache) with a size value of 0 or a negative number.
Common situations: 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.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- error in last cache
- {0}
- At least one field is required
- Cannot overwrite Processing Engine Trigger
- catalog subscription error
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/228879fc087a6fc7.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_catalog/src/error.rs:267
},
#[error("Processing Engine Unimplemented: {}", feature_description)]
ProcessingEngineUnimplemented { feature_description: String },
#[error(
"Processing Engine Trigger {} not in DB {}",
trigger_name,
database_name
)]
ProcessingEngineTriggerNotFound {
database_name: String,
trigger_name: String,
},
#[error("failed to parse trigger from {}", trigger_spec)]
ProcessingEngineTriggerSpecParseError { trigger_spec: String },
#[error("last cache size must be greater than 0")]
InvalidLastCacheSize,
#[error("failed to parse trigger from {trigger_spec}{}", .context.as_ref().map(|context| format!(": {context}")).unwrap_or_default())]
TriggerSpecificationParseError {
trigger_spec: String,
context: Option<String>,
},
#[error("invalid error behavior {0}")]
InvalidErrorBehavior(String),
#[error("cannot parse token permission, {0}")]
CannotParsePermissionForToken(String),
#[error("token name already exists, {0}")]
TokenNameAlreadyExists(String),
#[error("token hash already exists")]View on GitHub (pinned to 06200ef96b)