cube-js/cube · error

Path can't be undefined

Error message

Path can't be undefined

What it means

The paired guard in CubeEvaluator.byPath: the member path argument was falsy (undefined/empty) when resolving a typed member. A path must be a 'cubeName.memberName' string or [cube, name] array; an empty path means a caller passed unpopulated resolution state. Internal guard — indicates a bug in the calling compiler code rather than invalid user schema. The input at fault is an undefined/empty `path`.

Source

Thrown at packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts:1076

    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]];
    if (member === undefined) {
      throw new UserError(`'${cubeAndName[1]}' not found for path '${path}'`);
    }

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Pass a valid member path string or [cube, member] array to byPath
  2. Fix callers that destructure or resolve paths and may yield undefined
  3. Guard path construction (e.g. optional chained member names) before calling the evaluator
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts:1076 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/178b1ebe1bc42d16. Report an issue: GitHub.