cube-js/cube · error · UserError
${type} not defined for path '${path}'
Error message
${type} not defined for path '${path}' What it means
A UserError in CubeEvaluator.byPath: the cube portion of the member path resolved, but the cube object has no members collection for the requested type — i.e. the member path was looked up under a category (measures/dimensions/segments/preAggregations) the cube does not define. Typical cause is a typo'd member reference or querying a member of the wrong category (e.g. treating a dimension as a measure). The input at fault is a type+path pair whose cube lacks that member category.
Source
Thrown at packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts:1087
public byPath<T extends 'measures' | 'dimensions' | 'segments' | 'preAggregations'>(type: T, path: string | string[]): EvaluatedCube[T][string] {
if (!type) {
throw new Error(`Type can't be undefined for '${path}'`);
}
if (!path) {
throw new Error('Path can\'t be undefined');
}
const cubeAndName = Array.isArray(path) ? path : path.split('.');
const cube = this.evaluatedCubes[cubeAndName[0]];
if (cube === undefined) {
throw new UserError(`Cube '${cubeAndName[0]}' not found for path '${path}'`);
}
const typeMembers = cube[type];
if (typeMembers === undefined) {
throw new UserError(`${type} not defined for path '${path}'`);
}
const member = typeMembers[cubeAndName[1]];
if (member === undefined) {
throw new UserError(`'${cubeAndName[1]}' not found for path '${path}'`);
}
return member as EvaluatedCube[T][string];
}
public parsePath(type: 'measures' | 'dimensions' | 'segments' | 'preAggregations', path: string): string[] {
// Should throw UserError in case of parse error
this.byPath(type, path);
return path.split('.');
}
public isRbacEnabledForCube(cube: any): boolean {
return cube.accessPolicy?.length;View on GitHub (pinned to 7d981676b3)
Solutions
- Request an existing member type for the cube: measures, dimensions, segments, or preAggregations
- Check the cube name in the path is correct — the cube resolved but lacks the requested member category
- Use byPathAnyType when the member category is not known in advance
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts:1087 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/9dfaeeabef546a5a.
Report an issue: GitHub.