{"record":{"id":"6f1e80a8c965bb9d","repo":"cube-js/cube","slug":"unsupported-python-trailer-children-node-node-c","errorCode":null,"errorMessage":"Unsupported Python Trailer children node: ${node.constructor.name}: ${node.getText()}","messagePattern":"Unsupported Python Trailer children node: (.+?): (.+?)","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/parser/PythonParser.ts","lineNumber":219,"sourceCode":"          const argsList = node.arglist();\n          if (argsList) {\n            // arglist have a single child: arguments _list_\n            const args = children[0];\n            return { call: args };\n          } else {\n            return { call: [] };\n          }\n        } else if (node instanceof TrailerContext) {\n          const name = node.NAME();\n          const argsList = node.callArguments();\n          if (argsList) {\n            // trailer with callArguments have a single child: CallArgumentsContext\n            // which was already processed (see other if branch)\n            return children[0];\n          } else if (name) {\n            return { identifier: t.identifier(name.getText()) };\n          } else {\n            throw new UserError(`Unsupported Python Trailer children node: ${node.constructor.name}: ${node.getText()}`);\n          }\n        } else if (node instanceof VfpdefContext) {\n          const name = node.NAME();\n          if (name) {\n            return t.identifier(name.getText());\n          } else {\n            throw new UserError(`Unsupported Python vfpdef children node: ${node.constructor.name}: ${node.getText()}`);\n          }\n        } else if (node instanceof VarargslistContext) {\n          return { args: children };\n        } else if (node instanceof LambdefContext) {\n          return t.arrowFunctionExpression(children[0].args, children[1]);\n        } else if (node instanceof Not_testContext) {\n          if (node.getChildCount() === 1) {\n            return children[0];\n          }\n          return t.unaryExpression('!', children[0]);\n        } else if (node instanceof And_testContext) {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/parser/PythonParser.ts#L201-L237","documentation":"Thrown by PythonParser.transpileToJs() when a TrailerContext (the () call or .name attribute part of an expression) has neither callArguments nor a NAME child, so the visitor cannot tell if it is a call or attribute access and throws a UserError with the context class and text.","triggerScenarios":"parsePythonAndTranspileToJs visits a TrailerContext whose children are neither a CallArgumentsContext (already handled) nor a NAME token — e.g. subscript trailers like obj[0], slices, or unusual parenthesis contents not captured as callArguments.","commonSituations":"Developers use Python indexing (items[0]), slicing, or generator expressions inside a data model file; the transpiler supports only plain calls obj(...) and attribute access obj.name, so schema compile fails.","solutions":["Replace subscript/slice expressions (x[0]) with supported syntax — e.g. pass plain arguments to calls or restructure the model","Restrict data-model Python to calls, attribute access, literals, identifiers, and lambdas","Simplify the exact expression named in the error text","Extend the TrailerContext branch in PythonParser.ts to handle subscripts if needed"],"exampleFix":"// before (cubes.py)\ncube(config['name'], sql=config['sql'])\n// after\ncube('my_cube', sql='SELECT * FROM t')","handlingStrategy":"validation","validationCode":"// Reject subscript/slice syntax before compiling\nif (/\\w\\s*\\[.*\\]/.test(pySource)) {\n  throw new Error('Indexing/slicing (x[...]) is not supported in data-model Python');\n}","typeGuard":null,"tryCatchPattern":"try {\n  parsePythonAndTranspileToJs(source);\n} catch (e) {\n  if (e instanceof UserError && e.message.includes('Unsupported Python Trailer children')) {\n    throw new Error(`Rewrite call/attribute chain: ${e.message}`);\n  }\n  throw e;\n}","preventionTips":["Limit trailer usage to method calls obj(...) and attributes obj.name","Replace x[i] lookups with function arguments or constants","Keep lambdas and calls simple in data models","Use the node text in the error to locate and simplify the expression"],"tags":["python","transpilation","schema-compiler","unsupported-syntax"],"backgroundTag":"python-transpile-unsupported-node","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}