elastic/elasticsearch · error · InvalidUserDataException
Missing "from" setting for license name mapping
Error message
Missing "from" setting for license name mapping
What it means
Thrown by AbstractDependenciesTask.mapping when the supplied map lacks the required "from" key. A mapping links a regex matching a jar name to a prefix used to locate that jar's LICENSE and NOTICE files; both "from" and "to" are mandatory.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java:33
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import java.util.Map;
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
- Add the 'from' key with the jar-name regex to the mapping map.
- Use the documented map literal form mapping(from: '<regex>', to: '<prefix>').
- Check the surrounding dependencyLicenses block for a malformed closure.
Example fix
// before dependencyLicenses.mapping(['to': 'lucene']) // after dependencyLicenses.mapping(from: 'lucene-core', to: 'lucene')
Defensive patterns
Strategy: validation
Validate before calling
if (props.get("from") == null) {
throw new InvalidUserDataException("Missing \"from\" setting for license name mapping");
} Prevention
- Use the named-argument form mapping(from: '...', to: '...') in Groovy DSL so missing keys are obvious.
- Lint build scripts for mapping calls with exactly two keys.
- Keep a single canonical example of a mapping block for contributors to copy.
When it happens
Trigger: Calling dependencyLicenses.mapping([:]) or dependencyLicenses.mapping(['to': 'lucene']) in a build.gradle, omitting the from entry.
Common situations: Build-script typo; copying a mapping block and dropping a key; constructing the map programmatically and forgetting one entry.
Related errors
- Missing "to" setting for license name mapping
- Unknown properties for mapping on dependencyLicenses: {}
- License category name must be exactly 5 characters, got ${ca
- Cannot set Elasticsearch Distribution type to ${type}. Type
- platform cannot be set on elasticsearch distribution [${name
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/b7f341d604998741.
Report an issue: GitHub.