{"record":{"id":"fbcfa236d915fc93","repo":"karatelabs/karate","slug":"failed-to-load-pom","errorCode":null,"errorMessage":"Failed to load pom: ","messagePattern":"Failed to load pom: ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/cli/RunCommand.java","lineNumber":350,"sourceCode":"    }\n\n    private void loadPom() {\n        String file = pomFile != null ? pomFile : DEFAULT_POM_FILE;\n        Path pomPath;\n\n        // If workdir specified, look for pom there\n        if (workingDir != null) {\n            pomPath = Path.of(workingDir).resolve(file);\n        } else {\n            pomPath = Path.of(file);\n        }\n\n        if (Files.exists(pomPath)) {\n            try {\n                pom = KaratePom.load(pomPath);\n                Console.println(Console.info(pomPath.getFileName() + \" loaded\"));\n            } catch (Exception e) {\n                Console.println(Console.warn(\"Failed to load pom: \" + e.getMessage()));\n            }\n        }\n    }\n\n    private List<String> resolvePaths() {\n        List<String> combined = new ArrayList<>();\n        if (paths != null) {\n            combined.addAll(paths);\n        }\n        if (pathOptions != null) {\n            combined.addAll(pathOptions);\n        }\n        if (!combined.isEmpty()) {\n            return combined;\n        }\n        if (pom != null && !pom.getPaths().isEmpty()) {\n            return pom.getPaths();\n        }","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/cli/RunCommand.java#L332-L368","documentation":"`karate run` optionally loads a pom.xml (via KaratePom.load) to augment classpath/config resolution. If parsing fails, the CLI prints 'Failed to load pom: <message>' as a warning and continues the run without the pom data; the exception is not rethrown. Malformed or unsupported pom structure degrades the run but does not abort it.","triggerScenarios":"Running `karate run` in a directory (or with a resolved path) containing a pom.xml that is unparseable XML or structurally invalid for KaratePom.load — e.g. truncated file, wrong root element, encoding issues.","commonSituations":"Partial/failed Maven build leaving a corrupt pom; pointing Karate at a non-Maven project's XML file named pom.xml; pom generated by a tool with features KaratePom doesn't understand.","solutions":["Read the appended e.getMessage() in the warning to identify the parse failure","Validate the pom.xml with `mvn -q validate` or an XML parser and fix the malformed section","Move/rename the invalid pom.xml out of the run directory if it is not needed","Regenerate the pom (e.g. re-run the failed Maven build) and rerun `karate run`"],"exampleFix":"// before\n<project><build></project> <!-- truncated pom -->\n// after\nmvn -q validate   # fix XML, then\nkarate run        # \"pom.xml loaded\"","handlingStrategy":"validation","validationCode":"// before karate run\npython3 -c \"import xml.dom.minidom,sys; xml.dom.minidom.parse('pom.xml')\" && echo 'pom XML valid' || echo 'pom malformed'","typeGuard":null,"tryCatchPattern":"karate run ... 2>&1 | tee run.log; grep 'Failed to load pom' run.log && echo 'pom ignored — fix pom.xml'","preventionTips":["Keep pom.xml well-formed (validate with `mvn -q validate`)","Don't leave truncated poms from interrupted builds — regenerate them","Only point Karate at real Maven project directories","Treat the warning as a prompt to fix, since pom-derived config was skipped"],"tags":["cli","maven","pom","xml-parse"],"backgroundTag":"config-file-not-found","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"}