{"record":{"id":"a6c772125bd6c3c6","repo":"cube-js/cube","slug":"unsupported-python-vfpdef-children-node-node-co","errorCode":null,"errorMessage":"Unsupported Python vfpdef children node: ${node.constructor.name}: ${node.getText()}","messagePattern":"Unsupported Python vfpdef children node: (.+?): (.+?)","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/parser/PythonParser.ts","lineNumber":226,"sourceCode":"          }\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) {\n          if (children.length === 1) {\n            return children[0];\n          }\n          return children.reduce((left, right) => t.logicalExpression('&&', left, right));\n        } else if (node instanceof Or_testContext) {\n          if (children.length === 1) {\n            return children[0];","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/parser/PythonParser.ts#L208-L244","documentation":"Thrown by PythonParser.transpileToJs() when a VfpdefContext (a function-parameter definition inside a lambda/def parameter list) has no NAME token, so no identifier can be created for the parameter. The visitor throws a UserError naming the context and its text.","triggerScenarios":"parsePythonAndTranspileToJs visits a VfpdefContext where node.NAME() is null — typically from ANTLR error recovery on malformed parameter lists, or parameter forms (typed/starred params) not represented as a plain NAME in the grammar path taken.","commonSituations":"Usually follows a syntax error in a lambda or function definition in the data model (e.g. lambda with malformed arguments) where recovery produced an empty vfpdef node; rarely hit by valid Python.","solutions":["Fix syntax errors in lambda/function parameter lists in the data model file (run the file through Python to validate first)","Rewrite parameter definitions as plain identifiers without type annotations","Simplify the lambda to a single plain parameter, e.g. lambda x: ...","Report as a bug if valid Python triggers it, including the snippet from the error text"],"exampleFix":"// before (cubes.py)\nconvert = lambda x: x.upper  # malformed/empty param from typo: lambda : .upper\n// after\nconvert = lambda x: x.upper()","handlingStrategy":"validation","validationCode":"// Validate lambdas/params with real Python first\nconst { execSync } = require('child_process');\ntry { execSync(`python3 -c \"compile(open('model.py').read(),'model.py','exec')\"`); }\ncatch { throw new Error('Model file has Python syntax errors (check lambda parameter lists)'); }","typeGuard":null,"tryCatchPattern":"try {\n  parsePythonAndTranspileToJs(source);\n} catch (e) {\n  if (e instanceof UserError && e.message.includes('Unsupported Python vfpdef')) {\n    throw new Error(`Malformed lambda parameter: ${e.message}`);\n  }\n  throw e;\n}","preventionTips":["Ensure every lambda has well-formed, plain parameters (lambda x: ...)","Run python3 -m py_compile on model files before deploying","Avoid type-annotated or starred parameters in model lambdas","Double-check for stray colons/commas in parameter lists"],"tags":["python","transpilation","schema-compiler","parameters"],"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"}