elastic/elasticsearch · error · InvalidUserDataException

Missing "to" setting for license name mapping

Error message

Missing "to" setting for license name mapping

What it means

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'.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java:37

public abstract class AbstractDependenciesTask extends DefaultTask {

    @Input
    @Optional
    public abstract MapProperty<String, String> getMappings();

    /**
     * Add a mapping from a regex pattern for the jar name, to a prefix to find
     * the LICENSE and NOTICE file for that jar.
     */
    public void mapping(Map<String, String> props) {
        String from = props.get("from");
        if (from == null) {
            throw new InvalidUserDataException("Missing \"from\" setting for license name mapping");
        }
        String to = props.get("to");
        if (to == null) {
            throw new InvalidUserDataException("Missing \"to\" setting for license name mapping");
        }
        if (props.size() > 2) {
            throw new InvalidUserDataException("Unknown properties for mapping on dependencyLicenses: " + props.keySet());
        }
        getMappings().put(from, to);
    }
}

View on GitHub (pinned to db6a809a66)

Solutions

  1. Add the 'to' key with the LICENSE/NOTICE file prefix to the mapping map.
  2. Use the documented form mapping(from: '<regex>', to: '<prefix>').
  3. Verify the prefix actually corresponds to a checked-in license file.

Example fix

// before
dependencyLicenses.mapping(from: 'lucene-core')
// after
dependencyLicenses.mapping(from: 'lucene-core', to: 'lucene')
Defensive patterns

Strategy: validation

Validate before calling

if (props.get("to") == null) {
    throw new InvalidUserDataException("Missing \"to\" setting for license name mapping");
}

Prevention

When it happens

Trigger: Calling dependencyLicenses.mapping(['from': 'lucene-core']) in a build.gradle without providing 'to'.

Common situations: Build-script typo; partial copy of a mapping entry; programmatic map construction missing the destination prefix.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/52fcd01eed12af81. Report an issue: GitHub.