{"record":{"id":"7e6b783a94aa38c5","repo":"apache/maven","slug":"provides-token-key-doesn-t-have-any-valu","errorCode":null,"errorMessage":"Provides token '\" + key + \"' doesn't have any value configured.","messagePattern":"Provides token '\" \\+ key \\+ \"' doesn't have any value configured\\.","errorType":"exception","errorClass":"MisconfiguredToolchainException","httpStatus":null,"severity":"error","filePath":"compat/maven-compat/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java","lineNumber":70,"sourceCode":"    @Override\n    public ToolchainPrivate createToolchain(ToolchainModel model) throws MisconfiguredToolchainException {\n        if (model == null) {\n            return null;\n        }\n\n        // use DefaultJavaToolChain for compatibility with maven 3.2.3 and earlier\n\n        @SuppressWarnings(\"deprecation\")\n        JavaToolchainImpl jtc = new DefaultJavaToolChain(model, logger);\n\n        // populate the provides section\n        Properties provides = model.getProvides();\n        for (Entry<Object, Object> provide : provides.entrySet()) {\n            String key = (String) provide.getKey();\n            String value = (String) provide.getValue();\n\n            if (value == null) {\n                throw new MisconfiguredToolchainException(\n                        \"Provides token '\" + key + \"' doesn't have any value configured.\");\n            }\n\n            RequirementMatcher matcher;\n            if (\"version\".equals(key)) {\n                matcher = RequirementMatcherFactory.createVersionMatcher(value);\n            } else {\n                matcher = RequirementMatcherFactory.createExactMatcher(value);\n            }\n\n            jtc.addProvideToken(key, matcher);\n        }\n\n        // populate the configuration section\n        Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();\n        Xpp3Dom javahome = dom != null ? dom.getChild(JavaToolchainImpl.KEY_JAVAHOME) : null;\n        if (javahome == null) {\n            throw new MisconfiguredToolchainException(","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java#L52-L88","documentation":"JavaToolchainFactory iterates the <provides> section of a jdk toolchain in toolchains.xml and requires every token to have a value. When a provides entry has a null value (element present but no content mapped to a value), MisconfiguredToolchainException(\"Provides token '<key>' doesn't have any value configured.\") aborts toolchain creation. The token named in the message is the one to fix.","triggerScenarios":"A toolchains.xml jdk toolchain containing a <provides> entry whose element has no value — e.g. <provides><vendor/></provides> — parsed into a Properties entry with null value and rejected by the factory.","commonSituations":"Copy-pasted toolchain templates with placeholder tokens never filled in; scripts generating toolchains.xml omitting the value for one token; commented-out values accidentally leaving empty elements behind.","solutions":["Open toolchains.xml, find the <provides> token named in the message, and give it a value (e.g. <version>17</version>, <vendor>temurin</vendor>)","Remove the token entirely if it is not needed for matching","Keep values consistent with what projects request via maven-toolchains-plugin <requires> so matching still succeeds afterwards"],"exampleFix":"<!-- before -->\n<provides>\n  <version>17</version>\n  <vendor/>\n</provides>\n\n<!-- after -->\n<provides>\n  <version>17</version>\n  <vendor>temurin</vendor>\n</provides>","handlingStrategy":"validation","validationCode":"import org.apache.maven.toolchain.model.ToolchainModel;\nimport java.util.Properties;\n\nvoid assertProvidesAllValued(ToolchainModel model) {\n    Properties provides = model.getProvides();\n    for (Entry<Object, Object> e : provides.entrySet()) {\n        if (e.getValue() == null) {\n            throw new IllegalStateException(\n                \"Provides token '\" + e.getKey() + \"' has no value — fix toolchains.xml\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    ToolchainPrivate toolchain = toolchainFactory.createToolchain(model, log);\n} catch (MisconfiguredToolchainException e) {\n    if (e.getMessage().contains(\"doesn't have any value configured\")) {\n        reportToolchainsXmlError(e.getMessage()); // message names the exact token to fix\n    } else {\n        throw e;\n    }\n}","preventionTips":["Fill every <provides> token at authoring time; empty placeholders only defer the failure to build time","Lint toolchains.xml in machine provisioning (a 5-line script checking for empty elements) before first mvn run","Match token names/values with the <requires> section of projects using the toolchain"],"tags":["maven","toolchains","configuration","validation"],"backgroundTag":"missing-config-value","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}