{"record":{"id":"9138701c8a536be3","repo":"karatelabs/karate","slug":"call-expression-must-resolve-to-a-feature-path","errorCode":null,"errorMessage":"call expression must resolve to a feature path: ","messagePattern":"call expression must resolve to a feature path: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/core/StepExecutor.java","lineNumber":2939,"sourceCode":"                // (the V1 path — see evalKarateExpression). Variables and JS exprs\n                // also resolve here; embedded-expression walking is built in.\n                Object argObj = evalKarateExpression(text.substring(closeParen + 1).trim());\n                if (argObj instanceof List) {\n                    expr.argList = (List<?>) argObj;\n                } else if (argObj instanceof Map) {\n                    @SuppressWarnings(\"unchecked\")\n                    Map<String, Object> argMap = (Map<String, Object>) argObj;\n                    expr.arg = argMap;\n                }\n            }\n        } else {\n            // Not a read() call - try evaluating as expression\n            // Could be a variable that holds a feature path\n            Object result = runtime.eval(text);\n            if (result instanceof String) {\n                parsePathAndTag((String) result, expr);\n            } else {\n                throw new RuntimeException(\"call expression must resolve to a feature path: \" + text);\n            }\n        }\n\n        return expr;\n    }\n\n    /**\n     * Parse path and tag/line selector from a feature path.\n     * Supports:\n     * - file.feature@tag - call specific scenario by tag\n     * - file.feature:N (or file.feature:N:M) - call by line number(s)\n     * - @tag - call scenario in same file by tag\n     */\n    private void parsePathAndTag(String rawPath, CallExpression expr) {\n        StepUtils.ParsedFeaturePath parsed = StepUtils.parseFeaturePath(rawPath);\n        expr.path = parsed.path();\n        expr.tagSelector = parsed.tagSelector();\n        expr.sameFile = parsed.sameFile();","sourceCodeStart":2921,"sourceCodeEnd":2957,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/StepExecutor.java#L2921-L2957","documentation":"For `call <text>` where the text is not a read() call, the executor evaluates it as a Karate expression expecting a String feature path (optionally with @tags). If the expression evaluates to a non-String (map, list, null-wrapped object, etc.), no feature path can be parsed and this error is thrown with the original expression text.","triggerScenarios":"`call someVar` where someVar holds a JSON/map/list; `call #(expr)` whose expression returns a non-string; JS function expressions used after `call` that return objects instead of a feature path string.","commonSituations":"Shadowing a feature-path variable with data earlier in the scenario; misunderstanding that `call` of a JS function requires different syntax in this engine; migration from Karate versions where call accepted function objects.","solutions":["Make the expression return a string path: `def path = 'classpath:com/feat.feature'` then `call path`","Use `call read('...')` for direct file references","If calling a JS function, ensure the keyword/syntax used supports it (or wrap as call read of a feature that calls it)","print the evaluated expression result to confirm its type"],"exampleFix":"// before\n* def info = { path: 'users.feature' }\n* call info\n// after\n* call info.path\n# or ensure: * def info = 'users.feature'","handlingStrategy":"type-guard","validationCode":"* if (typeof pathVar != 'string') karate.fail('call expression must be a string path')","typeGuard":"function isString(v) { return typeof v === 'string'; }","tryCatchPattern":null,"preventionTips":["Ensure call expressions evaluate to strings","print evaluated call expressions during development","Avoid variable shadowing between feature paths and payloads"],"tags":["call","type-mismatch","expression"],"backgroundTag":"type-mismatch","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-16T19:17:19.609Z"}