{"record":{"id":"cedf2d1a74d45cb1","repo":"karatelabs/karate","slug":"karate-call-requires-at-least-one-argument-feature-path","errorCode":null,"errorMessage":"karate.call() requires at least one argument (feature path)","messagePattern":"karate\\.call\\(\\) requires at least one argument \\(feature path\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/core/KarateJs.java","lineNumber":693,"sourceCode":"                }\n                if (rt == null) {\n                    throw new RuntimeException(\"karate.match(String) is not available in this context\");\n                }\n                String expression = args[0].toString();\n                Result result = rt.getExecutor().evalMatchString(expression, null);\n                return result.toMap();\n            }\n        };\n    }\n\n    private JavaInvokable call() {\n        return args -> {\n            ScenarioRuntime rt = getRuntime();\n            if (rt == null) {\n                throw new RuntimeException(\"karate.call() is not available in this context\");\n            }\n            if (args.length == 0) {\n                throw new RuntimeException(\"karate.call() requires at least one argument (feature path)\");\n            }\n            // V1 compatible signatures:\n            // call(path) - isolated scope\n            // call(path, arg) - isolated scope with arg\n            // call(sharedScope, path) - explicit scope\n            // call(sharedScope, path, arg) - explicit scope with arg\n            boolean sharedScope = false;\n            String path;\n            Object arg;\n            if (args[0] instanceof Boolean) {\n                sharedScope = (Boolean) args[0];\n                if (args.length < 2) {\n                    throw new RuntimeException(\"karate.call() with sharedScope requires a feature path\");\n                }\n                path = args[1].toString();\n                arg = args.length > 2 ? args[2] : null;\n            } else {\n                path = args[0].toString();","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/KarateJs.java#L675-L711","documentation":"karate.call() requires a feature (or script) path as its first argument; with zero arguments there is nothing to call. The runtime check has already passed, so this fires when a runtime exists but no arguments were supplied to the JavaInvokable.","triggerScenarios":"Calling karate.call() with an empty argument list while a scenario runtime is active — e.g. karate.call() directly, or karate.call(...args) where args resolves to [].","commonSituations":"Dynamic call-site construction where the feature path variable is undefined or the arguments array is empty; typos dropping the path; refactors that removed a default path.","solutions":["Pass the feature path: karate.call('classpath:path/to/feature.feature') or karate.call(path, arg).","Use the explicit-scope signature when needed: karate.call(true, path) / karate.call(false, path, arg).","Guard dynamic call sites: only invoke karate.call when the path string is non-empty."],"exampleFix":"// before\nkarate.call();\n// after\nkarate.call('classpath:helpers/utils.feature', { foo: 'bar' });","handlingStrategy":"validation","validationCode":"if (typeof path !== 'string' || path.length === 0) {\n  throw new Error('karate.call requires a feature path');\n}\nkarate.call(path, arg);","typeGuard":"function isFeaturePath(p) { return typeof p === 'string' && p.trim().length > 0 && p.includes('.feature'); }","tryCatchPattern":"var result;\ntry {\n  result = karate.call(path, arg);\n} catch (e) {\n  if (String(e.message).includes('requires at least one argument')) {\n    throw new Error('feature path was undefined/empty when calling karate.call: ' + path);\n  }\n  throw e;\n}","preventionTips":["Verify the feature path variable is defined and non-empty before the call.","Use full classpath: prefixed paths to avoid resolution ambiguity.","In wrappers that forward arguments, assert arguments.length >= 1 before delegating to karate.call."],"tags":["javascript","api-misuse","missing-argument"],"backgroundTag":"missing-required-argument","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"}