{"record":{"id":"9bfc01f6f14e9a9c","repo":"influxdata/influxdb","slug":"service-limit-values-must-be-greater-than-0","errorCode":null,"errorMessage":"service limit values must be greater than 0","messagePattern":"service limit values must be greater than 0","errorType":"validation","errorClass":"ServiceLimitError","httpStatus":null,"severity":"error","filePath":"core/data_types/src/service_limits.rs","lineNumber":223,"sourceCode":"    }\n}\n\n/// Updating one, but not both, of the limits is what the UpdateNamespaceServiceProtectionLimit\n/// gRPC request supports, so match that encoding on the Rust side.\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub enum ServiceLimitUpdate {\n    /// Requesting an update to the maximum number of tables allowed in this namespace\n    MaxTables(MaxTables),\n    /// Requesting an update to the maximum number of columns allowed in each table in this\n    /// namespace\n    MaxColumnsPerTable(MaxColumnsPerTable),\n}\n\n/// Errors converting from raw values to the service limits\n#[derive(Error, Debug, Clone, Copy)]\npub enum ServiceLimitError {\n    /// A negative or 0 value was specified; those aren't allowed\n    #[error(\"service limit values must be greater than 0\")]\n    MustBeGreaterThanZero,\n\n    /// No value was provided so we can't update anything\n    #[error(\"a supported service limit value is required\")]\n    NoValueSpecified,\n\n    /// Limits are stored as `i32` in the database and transferred as i32 over protobuf, so even\n    /// though they are stored as `usize` in Rust, the `usize` value must be less than `i32::MAX`.\n    #[error(\"service limit values must fit in a 32-bit signed integer (`i32`)\")]\n    MustFitInI32,\n\n    /// Per-table column limits are restricted\n    #[error(\n        \"per-table column limits are restricted to a maximum value of {0} for system performance purposes\"\n    )]\n    ColumnLimitTooLarge(MaxColumnsPerTable),\n}\n","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/data_types/src/service_limits.rs#L205-L241","documentation":"`ServiceLimitError::MustBeGreaterThanZero` is raised when converting a raw value into a service limit (`ServiceLimitUpdate`) and the supplied value is negative or zero. Service limits define per-database/per-table maximums (e.g. max tables, max columns per table), and zero or negative values would make the limit meaningless. The library rejects such values at conversion time rather than at query time.","triggerScenarios":"Calling a service-limit conversion/update API (e.g. `ServiceLimitUpdate::try_from` style conversions in `service_limits.rs`) with a value <= 0, such as passing 0 for max_tables or max_columns_per_table in a limit update request.","commonSituations":"Misconfigured cluster or database limit settings loaded from config or protobuf where defaults were left at 0; programmatic limit updates that compute a limit as 0 (e.g. an empty multiplication or a failed subtraction); users specifying 'no limit' as 0 instead of omitting the field.","solutions":["Inspect the limit value being converted and change it to a positive integer (>= 1).","If 'no limit' was intended, omit the field (use None) instead of passing 0, so `NoValueSpecified`/no-op semantics apply.","Fix the source configuration (config file, environment, or API payload) that produced the 0/negative value.","If the value is computed, add a floor/clamp so the computed limit is always > 0 before conversion."],"exampleFix":"// before\nServiceLimitUpdate::MaxTables(0)\n// after\nServiceLimitUpdate::MaxTables(100) // any value > 0","handlingStrategy":"validation","validationCode":"fn validate_limit(v: usize) -> Result<usize, String> {\n    if v == 0 { Err(\"service limit values must be greater than 0\".into()) } else { Ok(v) }\n}","typeGuard":null,"tryCatchPattern":"match ServiceLimitUpdate::try_from(raw) {\n    Err(ServiceLimitError::MustBeGreaterThanZero) => log::warn!(\"limit <= 0 rejected; using default\"),\n    Ok(u) => apply(u),\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Never use 0 as a sentinel for 'no limit' — omit the field instead","Clamp computed limits with `.max(1)` before conversion","Validate limit config at startup, before applying updates"],"tags":["rust","service-limits","validation","config"],"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"}