cube-js/cube · error · InvalidConfiguration

Value "${maxAge}" is not valid for CUBEJS_TOUCH_PRE_AGG_CACH

Error message

Value "${maxAge}" is not valid for CUBEJS_TOUCH_PRE_AGG_CACHE_MAX_AGE. Must be less or equal then CUBEJS_TOUCH_PRE_AGG_TIMEOUT (${touchPreAggregationTimeout}).

What it means

Configuration consistency check in env.ts touchPreAggregationCacheMaxAge: CUBEJS_TOUCH_PRE_AGG_CACHE_MAX_AGE was parsed successfully as a positive int but exceeds CUBEJS_TOUCH_PRE_AGG_TIMEOUT, which is meaningless — the cache max age must be shorter than the touch timeout. Fires when the accessor is first invoked.

Source

Thrown at packages/cubejs-backend-shared/src/env.ts:776

   * Max number of elements
   */
  touchPreAggregationCacheMaxCount: (): number => get('CUBEJS_TOUCH_PRE_AGG_CACHE_MAX_COUNT')
    .default(8192)
    .asInt(),

  /**
   * Max cache
   */
  touchPreAggregationCacheMaxAge: (): number => {
    // eslint-disable-next-line no-use-before-define
    const touchPreAggregationTimeout = getEnv('touchPreAggregationTimeout');

    const maxAge = get('CUBEJS_TOUCH_PRE_AGG_CACHE_MAX_AGE')
      .default(Math.round(touchPreAggregationTimeout / 2))
      .asIntPositive();

    if (maxAge > touchPreAggregationTimeout) {
      throw new InvalidConfiguration(
        'CUBEJS_TOUCH_PRE_AGG_CACHE_MAX_AGE',
        maxAge,
        `Must be less or equal then CUBEJS_TOUCH_PRE_AGG_TIMEOUT (${touchPreAggregationTimeout}).`
      );
    }

    return maxAge;
  },

  /**
   * Expire time for touch records
   */
  touchPreAggregationTimeout: (): number => get('CUBEJS_TOUCH_PRE_AGG_TIMEOUT')
    .default(60 * 60 * 24)
    .asIntPositive(),

  /**
   * Maximum time for exponential backoff for pre-aggs (in seconds)

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Lower CUBEJS_TOUCH_PRE_AGG_CACHE_MAX_AGE to a value less than or equal to CUBEJS_TOUCH_PRE_AGG_TIMEOUT.
  2. Alternatively raise CUBEJS_TOUCH_PRE_AGG_TIMEOUT if the larger max age is intended.
  3. Unset CUBEJS_TOUCH_PRE_AGG_CACHE_MAX_AGE to use the default (half the timeout).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-backend-shared/src/env.ts:776 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/8fd181f15304ad3e. Report an issue: GitHub.