cube-js/cube · error
Load cache tries to load table ${preAggregation.tableName} o
Error message
Load cache tries to load table ${preAggregation.tableName} outside of tablePrefixes filter: ${this.tablePrefixes.join(', ')} What it means
PreAggregationLoadCache tracks which pre-aggregation tables this instance is allowed to load, filtered by tablePrefixes. getVersionEntries throws if preAggregation.tableName's schema-qualified name does not start with any allowed prefix. This is an internal safety check: it indicates the orchestrator is trying to fetch version entries for a pre-aggregation that was not selected for this load.
Source
Thrown at packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationLoadCache.ts:181
const contentKey = `${e.table_name}_${e.content_version}`;
if (!byContent[contentKey]) {
byContent[contentKey] = e;
}
const structureKey = `${e.table_name}_${e.structure_version}`;
if (!byStructure[structureKey]) {
byStructure[structureKey] = e;
}
if (!byTableName[e.table_name]) {
byTableName[e.table_name] = e;
}
});
return { versionEntries, byContent, byStructure, byTableName };
}
public async getVersionEntries(preAggregation): Promise<VersionEntriesObj> {
if (this.tablePrefixes && !this.tablePrefixes.find(p => preAggregation.tableName.split('.')[1].startsWith(p))) {
throw new Error(`Load cache tries to load table ${preAggregation.tableName} outside of tablePrefixes filter: ${this.tablePrefixes.join(', ')}`);
}
const redisKey = this.tablesCachePrefixKey(preAggregation);
if (!(await this.versionEntries[redisKey])) {
this.versionEntries[redisKey] = this.calculateVersionEntries(preAggregation).catch(e => {
delete this.versionEntries[redisKey];
throw e;
});
}
return this.versionEntries[redisKey];
}
public async keyQueryResult(sqlQuery: QueryWithParams, waitForRenew: boolean, priority: QueuePriority) {
const memoKey = this.queryCache.refreshKeyCacheKey(sqlQuery, this.dataSource);
if (!this.queryResults[memoKey]) {
this.queryResults[memoKey] = await this.queryCache.cacheRefreshKeyResult(
sqlQuery,
60 * 60,View on GitHub (pinned to 7d981676b3)
Solutions
- Verify the pre-aggregation belongs to the current load scope; do not call load for pre-aggregations outside tablePrefixes.
- Align tablePrefixes between the API instance and refresh worker so both use the same partition filter.
- Check the pre-aggregation's tableName (schema.table) matches your prefix expectations — the check tests only the part after the first '.'.
- If prefixes were set unintentionally, clear/adjust the options that pass tablePrefixes into PreAggregationLoadCache.
Example fix
// before
preAggregations: { tablePrefixes: ['my_schema.agg_'] } // tableName 'other_schema.agg_x' fails
// after
preAggregations: { tablePrefixes: ['my_schema.agg_', 'other_schema.agg_'] } Defensive patterns
Strategy: validation
Validate before calling
function withinPrefixes(tableName, prefixes) {
const table = String(tableName).split('.')[1] || '';
return !prefixes || prefixes.some(p => table.startsWith(p));
}
if (!withinPrefixes(preAggregation.tableName, loadCache.tablePrefixes)) throw new Error('pre-aggregation outside tablePrefixes'); Type guard
function isWithinTablePrefixes(t) {
return typeof t === 'string' &&
t.includes('.') &&
(this.tablePrefixes == null || this.tablePrefixes.some(p => t.split('.')[1].startsWith(p)));
} Try / catch
try {
const entries = await loadCache.getVersionEntries(preAggregation);
} catch (e) {
if (String(e.message).includes('outside of tablePrefixes')) {
console.error('Pre-aggregation scope mismatch:', preAggregation.tableName);
}
throw e;
} Prevention
- Keep tablePrefixes consistent across all orchestrator instances and refresh workers.
- Derive prefixes from your schema configuration instead of hardcoding.
- Log pre-aggregation table names when a partition filter is applied.
- Only load pre-aggregations produced by the same partition query.
When it happens
Trigger: Calling getVersionEntries with a pre-aggregation whose tableName split('.')[1] (table name after schema) does not start with any string in this.tablePrefixes; tablePrefixes was set (non-null) but the pre-aggregation comes from a different partition/scope.
Common situations: Refresh worker and API instance with mismatched partition prefixes; custom orchestration code passing pre-aggregations outside the filter; multi-tenant deployments where a table name doesn't match expected prefixes.
Related errors
- Unable to detect column types for pre-aggregation on empty v
- Create table failed: ${e}
- Unsupported table data passed to ${this.constructor}
- Unable to import (as rows) in Cube Store: empty columns. Mos
- Unsupported export bucket type: ${this.config.bucketType}
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/019348c8ef102bef.
Report an issue: GitHub.