{"record":{"id":"177a4cdf012f2ed0","repo":"apache/hadoop","slug":"40","errorCode":"40","errorMessage":"Failed to parse:  %s : %s","messagePattern":"Failed to parse:  (.+?) : (.+?)","errorType":"exception","errorClass":"ServiceLaunchException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/ServiceLauncher.java","lineNumber":967,"sourceCode":"          confResourceUrls.add(file.toURI().toURL());\n        }\n      }\n      if (line.hasOption(ARG_CONFCLASS)) {\n        // new resources to instantiate as configurations\n        List<String> classnameList = Arrays.asList(\n            line.getOptionValues(ARG_CONFCLASS));\n        LOG.debug(\"Configuration classes {}\", classnameList);\n        confClassnames.addAll(classnameList);\n      }\n      // return the remainder\n      return remainingArgs;\n    } catch (IOException e) {\n      // parsing problem: convert to a command argument error with\n      // the original text\n      throw new ServiceLaunchException(EXIT_COMMAND_ARGUMENT_ERROR, e);\n    } catch (RuntimeException e) {\n      // lower level issue such as XML parse failure\n      throw new ServiceLaunchException(EXIT_COMMAND_ARGUMENT_ERROR, e,\n          E_PARSE_FAILED + \" %s : %s\", argString, e);\n    }\n  }\n\n  /**\n   * Override point: create a generic options parser or subclass thereof.\n   * @param conf Hadoop configuration\n   * @param argArray array of arguments\n   * @return a generic options parser to parse the arguments\n   * @throws IOException on any failure\n   */\n  protected GenericOptionsParser createGenericOptionsParser(Configuration conf,\n      String[] argArray) throws IOException {\n    return new MinimalGenericOptionsParser(conf, commandOptions, argArray);\n  }\n\n  /**\n   * Verify that all the specified filenames exist.","sourceCodeStart":949,"sourceCodeEnd":985,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/service/launcher/ServiceLauncher.java#L949-L985","documentation":"Same ServiceLauncher.parseArguments path, but the failure is a RuntimeException escaping GenericOptionsParser — the canonical case being an XML parse failure raised while a -conf file is loaded during parsing. The launcher wraps it into ServiceLaunchException (exit code 40, EXIT_COMMAND_ARGUMENT_ERROR) keeping the original argument string in the first %s and the causing exception in the second %s so the root cause stays visible.","triggerScenarios":"Passing -conf/--conf with a not-well-formed XML file (unterminated tag, bad entity, wrong encoding) so Configuration loading inside the parser throws; a RuntimeException raised by an overridden createGenericOptionsParser() in a ServiceLauncher subclass; classpath problems surfacing while parser extensions load.","commonSituations":"Hand-edited site XML with typos; config files truncated mid-write by a crashed editor or deployment template; BOM or stray characters injected into XML by scripts; custom launcher subclasses throwing from parse hooks.","solutions":["Read the second %s — the wrapped exception names the XML file, line, and column of the problem","Validate the file with `xmllint --noout conf.xml` (or an XML editor) and fix or regenerate it","If you subclass ServiceLauncher, audit createGenericOptionsParser() overrides for runtime exceptions","Re-run the exact command from the message once the config parses cleanly"],"exampleFix":"<!-- before: unterminated property -->\n<property><name>fs.defaultFS</name><value>hdfs://nn:8020</property>\n<!-- after -->\n<property><name>fs.defaultFS</name><value>hdfs://nn:8020</value></property>","handlingStrategy":"validation","validationCode":"# fail fast on malformed XML before launching\nfor f in conf/*.xml; do\n  xmllint --noout \"$f\" || { echo \"malformed: $f\"; exit 1; }\ndone","typeGuard":null,"tryCatchPattern":"catch (ServiceLaunchException e) {\n  Throwable cause = (e.getCause() != null) ? e.getCause() : e;\n  // cause carries the underlying XML/parse error with file, line, column\n  log.error(\"launch failed, argv in message, cause below\", cause);\n}","preventionTips":["Run xmllint --noout over every -conf XML file in CI and deploy scripts","Generate configs from templates that cannot emit truncated XML","Never hand-edit deployed site files under time pressure without validation"],"tags":["cli","xml","configuration","service-launcher","exit-code-40"],"backgroundTag":"malformed-xml-config","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}