{"record":{"id":"5e550ec1f9516f13","repo":"karatelabs/karate","slug":"cannot-get-from-node","errorCode":null,"errorMessage":"cannot get from: ${node}","messagePattern":"cannot get from: (.+?)","errorType":"exception","errorClass":"JsErrorException (typeError)","httpStatus":null,"severity":"error","filePath":"karate-js/src/main/java/io/karatelabs/js/PropertyAccess.java","lineNumber":236,"sourceCode":"        setByName(site.target,\n                site.isIndex ? Terms.toPropertyKey(site.key) : (String) site.key,\n                value, context, trackingNode, site.receiver);\n    }\n\n    //=== Simple get/set operations ===\n\n    /**\n     * Get a property value from a node expression.\n     */\n    static Object get(Node node, CoreContext context) {\n                return switch (node.type) {\n            case REF_EXPR -> getRefExpr(node, context, false);\n            case REF_DOT_EXPR -> getRefDotExpr(node, context, false);\n            case REF_BRACKET_EXPR -> getRefBracketExpr(node, context, false);\n            case LIT_EXPR -> Interpreter.eval(node, context);\n            case PAREN_EXPR -> Interpreter.eval(node.get(1), context);\n            case FN_CALL_EXPR -> Interpreter.eval(node, context);\n            default -> throw JsErrorException.typeError(\"cannot get from: \" + node);\n        };\n    }\n\n    /**\n     * Get a callable for method invocation, publishing its receiver (this\n     * object) through {@link CoreContext#callReceiver} — read it immediately\n     * after this returns, before any further evaluation (see the field's\n     * contract note). For method calls like obj.method(), the receiver is\n     * obj; for direct calls like foo(), it is null.\n     */\n    static Object getCallable(Node node, CoreContext context) {\n        return switch (node.type) {\n            case REF_EXPR -> {\n                Object c = getRefExpr(node, context, true);\n                context.callReceiver = null;\n                yield c;\n            }\n            case REF_DOT_EXPR -> getCallableRefDotExpr(node, context);","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-js/src/main/java/io/karatelabs/js/PropertyAccess.java#L218-L254","documentation":"`PropertyAccess.get` switches on the AST node type of the expression being read; node kinds that cannot yield a value (unsupported reference forms) fall into the default branch and throw this TypeError with the offending node in the message. It indicates the expression form is not a readable value in Karate's JS grammar.","triggerScenarios":"Evaluating a get against a node type not in the handled set (REF_EXPR, REF_DOT_EXPR, REF_BRACKET_EXPR, LIT_EXPR, PAREN_EXPR, FN_CALL_EXPR) — typically a malformed or unsupported expression reaching the property-access layer, e.g. from a dynamically built or mis-parsed expression.","commonSituations":"Embedded JS expressions in Karate features with syntax the engine partially parses (e.g. `new Foo` without call context, arrow bodies in unusual positions); version mismatches where newer syntax hits an older handler table.","solutions":["Rewrite the expression into a supported form (parenthesize the sub-expression or assign it to a variable first).","Check the embedded JS for unsupported syntax and simplify it.","Upgrade karate-js to a version whose get-handler covers the syntax used."],"exampleFix":"// before\nvar x = obj.a.b; // written as an unsupported bare ref chain node\n// after\nvar x = (obj.a).b; // or: var t = obj.a; var x = t.b;","handlingStrategy":"try-catch","validationCode":"// pre-parse and whitelist supported node forms before evaluating\nconst supported = /^(lit|paren|ref|call)/i;\nif (expr && !supported.test(expr.trim())) throw new Error('unsupported get expression: ' + expr);","typeGuard":"function isReadable(expr) { return typeof expr === 'string' && !/^(new|delete|typeof)\\b/.test(expr.trim()); }","tryCatchPattern":"try { v = engine.get(path); } catch (e) { if (String(e.message).startsWith('cannot get from:')) { v = fallbackEval(path); } else { throw e; } }","preventionTips":["Keep embedded JS expressions simple and standard.","Parenthesize sub-expressions when chaining reads.","Keep karate-js versions in sync with syntax used in features."],"tags":["javascript","ast","type-error","parser"],"backgroundTag":"unsupported-operation","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}