stanfordnlp/CoreNLP · error · RuntimeException
Invalid relation mention argument role
Error message
Invalid relation mention argument role: ${role} What it means
An ACE corpus parsing failure in AceDomReader.parseRelationMention: a relation_mention_argument's ROLE attribute is not one of the recognized roles (arg-1, arg-2, etc.), meaning the ACE XML contains a relation argument role the reader does not map into mention args.
Solutions
- Extend parseRelationMention to handle additional roles or ignore unsupported ones instead of throwing.
- Filter relations with unsupported roles in a preprocessing pass over the .apf.xml files.
- Check the corpus version — standard ACE2005 relations only use arg-1/arg-2; a third role indicates a nonstandard or corrupted file.
- Normalize role casing (already case-insensitive here) and strip whitespace before the check if files contain stray whitespace.
Example fix
// before
} else {
throw new RuntimeException("Invalid relation mention argument role: " + role);
}
// after
} else {
logger.warning("Ignoring unsupported relation role: " + role);
} Defensive patterns
Strategy: try-catch
Validate before calling
Set<String> allowed = Set.of("arg-1", "arg-2");
if (!allowed.contains(role.toLowerCase())) { logger.warning("unsupported role: " + role); return; } Try / catch
try { parseRelationMention(...); } catch (RuntimeException e) { logger.warning("skipping relation: " + e.getMessage()); } Prevention
- Pre-filter .apf.xml relations to arg-1/arg-2 roles only.
- Normalize role strings (lowercase, trim) before parsing.
- Extend the reader when your corpus adds new relation argument types.
When it happens
Trigger: Parsing an ACE .apf.xml relation that contains an argument with a role other than arg-1/arg-2 (case-insensitive), e.g. time or place arguments, or a corpus variant emitting different role names.
Common situations: Processing ACE corpora or extensions with extra relation argument types, annotation tools writing roles in a different convention (e.g. 'Arg', 'ARG'), custom relation types added to the corpus.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Match failed!
- Bad data format:
- attempt to get word when sentence and lattice are null!
- Attempt to use ExternalFiniteDifference without passing…
- Attempted to parse empty/null tag
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/ea3420179e7ed701.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/ie/machinereading/domains/ace/reader/AceDomReader.java:77
// create the mention
AceRelationMention mention = new AceRelationMention(id, extent, lc);
// find the mention args
List<Node> args = getChildrenByName(node, "relation_mention_argument");
for(Node arg: args){
String role = getAttributeValue(arg, "ROLE");
String refid = getAttributeValue(arg, "REFID");
AceEntityMention am = doc.getEntityMention(refid);
if(am != null){
am.addRelationMention(mention);
if(role.equalsIgnoreCase("arg-1")){
mention.getArgs()[0] = new AceRelationMentionArgument(role, am);
} else if(role.equalsIgnoreCase("arg-2")){
mention.getArgs()[1] = new AceRelationMentionArgument(role, am);
} else {
throw new RuntimeException("Invalid relation mention argument role: " + role);
}
}
}
return mention;
}
/**
* Extracts info about one relation mention
*/
private static AceEventMention parseEventMention(Node node,
AceDocument doc) {
String id = getAttributeValue(node, "ID");
AceCharSeq extent = parseCharSeq(getChildByName(node, "extent"));
AceCharSeq anchor = parseCharSeq(getChildByName(node, "anchor"));
// create the mention
AceEventMention mention = new AceEventMention(id, extent, anchor);View on GitHub (pinned to 1b7edd19c4)