cube-js/cube · error
CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD ({}) must no
Error message
CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD ({}) must not be lower than CUBESTORE_CHUNKS_COUNT_THRESHOLD ({}), otherwise compaction will never reduce chunks below the readiness threshold What it means
CubeStore's validate_config panics if CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD is set lower than CUBESTORE_CHUNKS_COUNT_THRESHOLD. With such a configuration, compaction could never bring the chunk count below the readiness threshold, so the config is logically invalid and the server refuses to start.
Source
Thrown at rust/cubestore/cubestore/src/config/mod.rs:2279
pub fn update_config(
&self,
update_config: impl FnOnce(ConfigObjImpl) -> ConfigObjImpl,
) -> Config {
let new_config = self.config_obj.as_ref().clone();
let config = Self {
injector: self.injector.clone(),
config_obj: Arc::new(update_config(new_config)),
};
config.validate_config();
config
}
fn validate_config(&self) {
if let Some(readiness) = self.config_obj.compaction_readiness_chunks_threshold {
let compaction = self.config_obj.compaction_chunks_count_threshold;
if readiness < compaction {
panic!(
"CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD ({}) must not be lower than \
CUBESTORE_CHUNKS_COUNT_THRESHOLD ({}), otherwise compaction will never \
reduce chunks below the readiness threshold",
readiness, compaction,
);
}
}
}
pub async fn start_test<T>(&self, test_fn: impl FnOnce(CubeServices) -> T)
where
T: Future<Output = Result<(), CubeError>> + Send,
{
self.start_test_with_options::<_, T, _, _>(
true,
Option::<
Box<
dyn FnOnce(Arc<Injector>) -> Pin<Box<dyn Future<Output = ()> + Send>>View on GitHub (pinned to 7d981676b3)
Solutions
- Raise CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD to a value >= CUBESTORE_CHUNKS_COUNT_THRESHOLD
- Lower CUBESTORE_CHUNKS_COUNT_THRESHOLD instead if that matches intent
- Unset one or both variables to use the defaults, which are consistent
Example fix
// before CUBESTORE_CHUNKS_COUNT_THRESHOLD=10 CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD=5 // after CUBESTORE_CHUNKS_COUNT_THRESHOLD=10 CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD=20
Defensive patterns
Strategy: validation
Validate before calling
// fail fast when readiness < compaction threshold if [ -n "$CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD" ] && [ -n "$CUBESTORE_CHUNKS_COUNT_THRESHOLD" ] \ && [ "$CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD" -lt "$CUBESTORE_CHUNKS_COUNT_THRESHOLD" ]; then echo "readiness threshold must be >= compaction threshold"; exit 1; fi
Try / catch
null
Prevention
- Always set the two compaction thresholds together
- Keep readiness >= compaction threshold by convention (e.g. readiness = 2x compaction)
- Document the invariant in your ops runbook
- Unset both to use consistent built-in defaults
When it happens
Trigger: Configuring a readiness threshold smaller than the compaction trigger threshold, e.g. CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD=5 with CUBESTORE_CHUNKS_COUNT_THRESHOLD=10.
Common situations: Operators tuning compaction knobs independently without realizing readiness must be >= the compaction trigger; template configs copied between environments with only one of the two variables overridden.
Understand the failure class
Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.
Related errors
- Native api gateway is not enabled
- Either CUBEJS_DB_TYPE or CreateOptions.driverFactory must be
- CreateOptions.orchestratorOptions.rollupOnlyMode cannot be t
- wrong configuration for environment variable '{}' with '{}'
- wrong configuration for environment variable '{}' with '{}'
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/d87a515087759c74.
Report an issue: GitHub.