{"record":{"id":"07de3bd1e885ab10","repo":"karatelabs/karate","slug":"called-feature-failed-displayname-msg","errorCode":null,"errorMessage":"called feature failed: <displayName>[ - <msg>]","messagePattern":"called feature failed: <displayName>\\[ - <msg>\\]","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/core/StepExecutor.java","lineNumber":593,"sourceCode":"    List<Map<String, Object>> callFeatureLoop(Feature calledFeature, List<?> argList, String tagSelector, Set<Integer> lineFilters) {\n        List<Map<String, Object>> results = new ArrayList<>();\n        int loopIndex = 0;\n        for (Object item : argList) {\n            Map<String, Object> callArg = item instanceof Map ? (Map<String, Object>) item : null;\n            // Always isolated scope for array loop\n            Map<String, Object> vars = lastVars(runNestedFeature(calledFeature, callArg, false, tagSelector, lineFilters, loopIndex));\n            if (vars != null) {\n                results.add(vars);\n            }\n            loopIndex++;\n        }\n        return results;\n    }\n\n    void checkFeatureResult(FeatureResult featureResult) {\n        if (featureResult.isFailed()) {\n            String msg = featureResult.getFailureMessage();\n            throw new RuntimeException(\"called feature failed: \"\n                    + featureResult.getDisplayName()\n                    + (msg != null ? \" - \" + msg : \"\"));\n        }\n    }\n\n    /**\n     * Propagate results from a called feature back to the caller.\n     * Handles both isolated scope (resultVar set) and shared scope (resultVar null).\n     * For shared scope, also propagates config, cookies, and driver.\n     */\n    private void propagateFromCallee(ScenarioRuntime calleeRuntime, String resultVar) {\n        if (calleeRuntime == null) {\n            return;\n        }\n        if (resultVar != null) {\n            // Isolated scope - store only the callee's own contribution (delta), not the\n            // caller/config scope it inherited to read. See calleeResult.\n            runtime.setVariable(resultVar, calleeResult(calleeRuntime));","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/StepExecutor.java#L575-L611","documentation":"After Karate runs a called feature (via 'call' of another .feature file), checkFeatureResult inspects the child FeatureResult; if it is marked failed, the failure is rethrown as a RuntimeException 'called feature failed: <name> - <message>' so the caller's step fails and propagates the nested error message.","triggerScenarios":"A 'call' (or 'callonce') step invokes another feature and that feature has at least one failing step — assertion, match, HTTP status, or runtime error inside the called feature.","commonSituations":"Shared/setup features failing (missing test data, environment misconfig); matched values wrong in the called feature; timeouts on HTTP calls inside nested features; chain failures where the root cause is several layers deep.","solutions":["Look at the '- <msg>' suffix and the full report: it names the failing step/line inside the called feature","Run the called feature standalone to reproduce and debug it in isolation","Fix the underlying failure (match mismatch, HTTP error, missing variable) in the called feature","Check that variables expected by the called feature (via 'call ... {var: ...}') are actually passed and spelled correctly"],"exampleFix":"// before: called feature fails because var is undefined\ncall read('user.feature')\n// after: pass required variables explicitly\ncall read('user.feature') { userId: '#(userId)' }","handlingStrategy":"try-catch","validationCode":"// smoke-test the called feature standalone before wiring it into other features\n// run: com.intuit.karate.Runner.path(\"classpath:helpers/setup.feature\").parallel(1); and check exit status","typeGuard":null,"tryCatchPattern":"try { karate.call(\"read('setup.feature')\"); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"called feature failed: \")) { log.error(\"nested failure: {}\", e.getMessage()); } throw e; }","preventionTips":["Keep shared/setup features runnable and green on their own","Pass all required variables explicitly via 'call ... {var: value}'","Read the '- msg' suffix to locate the failing nested step","Avoid deep call chains that bury root causes"],"tags":["karate","call","feature","nested-failure"],"backgroundTag":"http-request-failed","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"}