cube-js/cube · error · UserError
From members are not found in [${memberPaths.map(m => m.join
Error message
From members are not found in [${memberPaths.map(m => m.join('.')).join(', ')}] for join ${JSON.stringify(j)}. Please make sure join fields are referencing dimensions instead of columns. What it means
After validating members, Cube partitions a join's SQL members into fromMembers (belonging to already-known join cubes) and toMembers. If no member in the join sql resolves to a cube already in the join map, there is nothing on the 'from' side and this UserError is thrown. Typically it means the join references columns instead of dimensions, or uses only the 'to' cube's members.
Source
Thrown at packages/cubejs-schema-compiler/src/adapter/PreAggregations.ts:1123
}
return fromPreAggObj[0];
}
private resolveJoinMembers(join: FinishedJoinTree): JoinEdgeWithMembers[] {
const joinMap = new Set<string>();
return join.joins.map(j => {
joinMap.add(j.originalFrom);
const memberPaths = this.query.collectMemberNamesFor(() => this.query.evaluateSql(j.originalFrom, j.join.sql)).map(m => m.split('.'));
const invalidMembers = memberPaths.filter(m => !joinMap.has(m[0]) && m[0] !== j.originalTo);
if (invalidMembers.length) {
throw new UserError(`Members ${invalidMembers.join(', ')} in join from '${j.originalFrom}' to '${j.originalTo}' doesn't reference join cubes`);
}
const fromMembers = memberPaths.filter(m => joinMap.has(m[0])).map(m => m.join('.'));
if (!fromMembers.length) {
throw new UserError(`From members are not found in [${memberPaths.map(m => m.join('.')).join(', ')}] for join ${JSON.stringify(j)}. Please make sure join fields are referencing dimensions instead of columns.`);
}
const toMembers = memberPaths.filter(m => m[0] === j.originalTo).map(m => m.join('.'));
if (!toMembers.length) {
throw new UserError(`To members are not found in [${memberPaths.map(m => m.join('.')).join(', ')}] for join ${JSON.stringify(j)}. Please make sure join fields are referencing dimensions instead of columns.`);
}
joinMap.add(j.originalTo);
return {
...j,
fromMembers,
toMembers,
};
});
}
private cubesHintsFromPreAggregation(preAggObj: PreAggregationForQuery): string[][] {
return R.uniq(
preAggObj.references.measures.concat(View on GitHub (pinned to 7d981676b3)
Solutions
- Rewrite the join sql to use member references from the from cube, e.g. '${CUBE}.customer_id = ${Customers}.id'.
- Ensure the join is defined on the correct cube so '${CUBE}' resolves to the expected from cube.
- Replace raw column names with cube-qualified dimension references inside the sql template.
Example fix
// before
sql: 'orders.customer_id = customers.id' // raw columns, no members found
// after
sql: '${CUBE}.customer_id = ${Customers}.id' Defensive patterns
Strategy: validation
Validate before calling
// Ensure at least one from-side member appears in a rollupJoin's sql before compiling
function hasFromSideMember(joinSql, fromCubes) {
return collectMemberNames(joinSql).some(name => fromCubes.includes(name.split('.')[0]));
}
if (!hasFromSideMember(join.sql, [join.from])) throw new Error('Join sql must reference from-cube dimensions'); Type guard
null
Try / catch
try { await cube.query(query); } catch (e) { if (/From members are not found/.test(e.message)) { console.error('Replace raw SQL columns with member references in join:', e.message); } else throw e; } Prevention
- Always write join sql as '${CUBE}.field = ${OtherCube}.field'
- Never use raw table/column names in join sql
- Verify the join is declared on the correct (from) cube
- Test rollupJoin compilation after any join edit
When it happens
Trigger: A rollupJoin join sql whose members all resolve to the 'to' cube (or to raw columns), so filter(m => joinMap.has(m[0])) yields an empty fromMembers array during buildJoinPreAggregationForQuery.
Common situations: Writing the join sql using raw SQL column names (e.g. 'orders.customer_id = customers.id') instead of Cube member references; writing the join in the wrong direction so all references point at the 'to' cube; missing template interpolation ('${CUBE}.x') so collectMemberNamesFor finds no cube-prefixed members.
Related errors
- To members are not found in [${memberPaths.map(m => m.join('
- Members ${invalidMembers.join(', ')} in join from '${j.origi
- Can't build join tree for pre-aggregation ${preAggObj.cube}.
- Nothing to join in rollup join. Target joins ${JSON.stringif
- No rollups found that can be used for a rollup join from "${
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/ee8d6e7500c313dd.
Report an issue: GitHub.