cube-js/cube · error
Type can't be undefined for '${path}'
Error message
Type can't be undefined for '${path}' What it means
A member-resolution guard in CubeEvaluator.byPath: the member type was not supplied (undefined) when resolving a member path such as 'cubeName.memberName'. byPath requires an explicit type from measures/dimensions/segments/preAggregations; callers should use byPathAnyType when the type is unknown. This is an internal programming error signal, not a user-facing data-model error. The input at fault is an undefined `type` argument.
Source
Thrown at packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts:1072
public byPathAnyType(path: string | string[]) {
if (this.isInstanceOfType('measures', path)) {
return this.byPath('measures', path);
}
if (this.isInstanceOfType('dimensions', path)) {
return this.byPath('dimensions', path);
}
if (this.isInstanceOfType('segments', path)) {
return this.byPath('segments', path);
}
throw new UserError(`Can't resolve member '${Array.isArray(path) ? path.join('.') : path}'`);
}
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]];View on GitHub (pinned to 7d981676b3)
Solutions
- Ensure byPath is called with a concrete member type ('measures' | 'dimensions' | 'segments' | 'preAggregations') — prefer byPathAnyType when the type is unknown
- Fix upstream callers that compute the type dynamically and may pass undefined
- Add a type-guard at the call site to narrow before invoking byPath
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts:1072 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/ffc878b6e8c34116.
Report an issue: GitHub.