{"record":{"id":"52fcd01eed12af81","repo":"elastic/elasticsearch","slug":"missing-to-setting-for-license-name-mapping","errorCode":null,"errorMessage":"Missing \"to\" setting for license name mapping","messagePattern":"Missing \"to\" setting for license name mapping","errorType":"exception","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java","lineNumber":37,"sourceCode":"\npublic abstract class AbstractDependenciesTask extends DefaultTask {\n\n    @Input\n    @Optional\n    public abstract MapProperty<String, String> getMappings();\n\n    /**\n     * Add a mapping from a regex pattern for the jar name, to a prefix to find\n     * the LICENSE and NOTICE file for that jar.\n     */\n    public void mapping(Map<String, String> props) {\n        String from = props.get(\"from\");\n        if (from == null) {\n            throw new InvalidUserDataException(\"Missing \\\"from\\\" setting for license name mapping\");\n        }\n        String to = props.get(\"to\");\n        if (to == null) {\n            throw new InvalidUserDataException(\"Missing \\\"to\\\" setting for license name mapping\");\n        }\n        if (props.size() > 2) {\n            throw new InvalidUserDataException(\"Unknown properties for mapping on dependencyLicenses: \" + props.keySet());\n        }\n        getMappings().put(from, to);\n    }\n}\n","sourceCodeStart":19,"sourceCodeEnd":45,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java#L19-L45","documentation":"Thrown by AbstractDependenciesTask.mapping when the supplied map lacks the required \"to\" key. The 'to' value is the prefix used to find the LICENSE/NOTICE file for jars matched by 'from'; it is mandatory alongside 'from'.","triggerScenarios":"Calling dependencyLicenses.mapping(['from': 'lucene-core']) in a build.gradle without providing 'to'.","commonSituations":"Build-script typo; partial copy of a mapping entry; programmatic map construction missing the destination prefix.","solutions":["Add the 'to' key with the LICENSE/NOTICE file prefix to the mapping map.","Use the documented form mapping(from: '<regex>', to: '<prefix>').","Verify the prefix actually corresponds to a checked-in license file."],"exampleFix":"// before\ndependencyLicenses.mapping(from: 'lucene-core')\n// after\ndependencyLicenses.mapping(from: 'lucene-core', to: 'lucene')","handlingStrategy":"validation","validationCode":"if (props.get(\"to\") == null) {\n    throw new InvalidUserDataException(\"Missing \\\"to\\\" setting for license name mapping\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the named-argument form mapping(from: '...', to: '...').","Validate the destination prefix corresponds to a checked-in license file.","Document the two mandatory keys next to every example mapping."],"tags":["gradle","licensing","build-script","build-tools"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}