elastic/elasticsearch · error · InvalidUserDataException
Parsing signatures failed: {}
Error message
Parsing signatures failed: {} What it means
Thrown when the forbidden-apis checker raises a ParseException while parsing a signatures file or the joined inline signatures string. The signature syntax is invalid (malformed method/field signature), so the checker cannot build its rule set. This is a user-data error in the signature definition, distinct from [243] which is an IO fault.
Source
Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/CheckForbiddenApisTask.java:519
}
}
final FileCollection signaturesFiles = getParameters().getSignaturesFiles();
if (signaturesFiles != null) for (final File f : signaturesFiles) {
checker.parseSignaturesFile(f);
}
final List<String> signatures = getParameters().getSignatures().get();
if ((signatures != null) && !signatures.isEmpty()) {
final StringBuilder sb = new StringBuilder();
for (String line : signatures) {
sb.append(line).append(NL);
}
checker.parseSignaturesString(sb.toString());
}
} catch (IOException ioe) {
throw new GradleException("IO problem while reading files with API signatures.", ioe);
} catch (ParseException pe) {
throw new InvalidUserDataException("Parsing signatures failed: " + pe.getMessage(), pe);
}
if (checker.hasNoSignatures()) {
if (checker.noSignaturesFilesParsed()) {
throw new InvalidUserDataException(
"No signatures were added to task; use properties 'signatures', 'bundledSignatures', 'signaturesURLs', and/or 'signaturesFiles' to define those!"
);
} else {
logger.info("Skipping execution because no API signatures are available.");
return;
}
}
try {
checker.addClassesToCheck(getParameters().getClassFiles());
} catch (IOException ioe) {
throw new GradleException("Failed to load one of the given class files.", ioe);
}View on GitHub (pinned to db6a809a66)
Solutions
- Read pe.getMessage() in the stack trace — it names the offending signature and the parse position.
- Open the cited signatures file/line and correct the signature to the form ClassName#methodName(descriptor) or ClassName#fieldName.
- Validate against the forbidden-apis documentation for the bundled version.
- Re-run the single task to confirm parsing succeeds.
Example fix
// before (broken) java.lang.String#substring(int,int) typo // after java.lang.String#substring(int,int)
Defensive patterns
Strategy: validation
Validate before calling
// Lint signature lines against the forbidden-apis grammar before passing them
for (String line : signatures) {
String s = line.trim();
if (s.isEmpty() || s.startsWith("#") || s.startsWith("@")) continue;
if (!s.matches("[\\w.$]+(#\\w+(\\([^)]*\))?|#\\w+|\\s+.*).*")) {
throw new InvalidUserDataException("Malformed signature: " + s);
}
} Try / catch
try {
checker.parseSignaturesString(joined);
} catch (InvalidUserDataException e) {
// e.getCause() is the ParseException; its message names the bad token
throw e;
} Prevention
- Validate signature syntax in CI by running the forbidden-apis task on every PR.
- Copy signature grammar from the bundled version's docs.
- Comment every non-obvious signature so reviewers catch typos.
When it happens
Trigger: A signature line that does not match the forbidden-apis signature grammar (e.g. missing class@method form, wrong descriptor syntax, unparseable type), supplied via the 'signatures' property or a signatures file.
Common situations: Hand-written signature files with typos; copying a signature from a different forbidden-apis version with incompatible grammar; an inline signatures string with stray characters; upgrading the forbidden-apis dependency which changed signature syntax.
Related errors
- IO problem while reading files with API signatures.
- No signatures were added to task; use properties 'signatures
- Failed to load one of the given class files.
- Forbidden API verification failed
- Missing 'classesDirs' or 'classpath' property.
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/4a11caf491b0c578.
Report an issue: GitHub.