{"record":{"id":"ffc878b6e8c34116","repo":"cube-js/cube","slug":"type-can-t-be-undefined-for-path","errorCode":null,"errorMessage":"Type can't be undefined for '${path}'","messagePattern":"Type can't be undefined for '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts","lineNumber":1072,"sourceCode":"  public byPathAnyType(path: string | string[]) {\n    if (this.isInstanceOfType('measures', path)) {\n      return this.byPath('measures', path);\n    }\n\n    if (this.isInstanceOfType('dimensions', path)) {\n      return this.byPath('dimensions', path);\n    }\n\n    if (this.isInstanceOfType('segments', path)) {\n      return this.byPath('segments', path);\n    }\n\n    throw new UserError(`Can't resolve member '${Array.isArray(path) ? path.join('.') : path}'`);\n  }\n\n  public byPath<T extends 'measures' | 'dimensions' | 'segments' | 'preAggregations'>(type: T, path: string | string[]): EvaluatedCube[T][string] {\n    if (!type) {\n      throw new Error(`Type can't be undefined for '${path}'`);\n    }\n\n    if (!path) {\n      throw new Error('Path can\\'t be undefined');\n    }\n\n    const cubeAndName = Array.isArray(path) ? path : path.split('.');\n    const cube = this.evaluatedCubes[cubeAndName[0]];\n    if (cube === undefined) {\n      throw new UserError(`Cube '${cubeAndName[0]}' not found for path '${path}'`);\n    }\n\n    const typeMembers = cube[type];\n    if (typeMembers === undefined) {\n      throw new UserError(`${type} not defined for path '${path}'`);\n    }\n\n    const member = typeMembers[cubeAndName[1]];","sourceCodeStart":1054,"sourceCodeEnd":1090,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts#L1054-L1090","documentation":"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.","triggerScenarios":"Thrown at packages/cubejs-schema-compiler/src/compiler/CubeEvaluator.ts:1072 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}