stanfordnlp/CoreNLP · warning

Current stack

Error message

${warning}
    ${fullExpression(startToken)}
    Current stack: ${trace}

What it means

The SemgrexParser (JavaCC-generated) prints a deprecation warning when a deprecated syntax form is parsed. warnDeprecated logs the warning text, the full matched expression, and a trimmed current stack trace so the offending call site can be located. Parsing still succeeds.

Solutions

  1. Rewrite the pattern using current Semgrex syntax per the latest Semgrex documentation.
  2. Use the logged stack trace to find the code/config line containing the deprecated pattern.
  3. Update the pattern programmatically with the semgrex migration notes (e.g. replace deprecated operators with new equivalents).
  4. Pin/upgrade the CoreNLP version consistently to avoid mixed-version pattern syntax.

Example fix

// before
SemgrexPattern p = SemgrexPattern.compile("{}>nsubj {}"); // deprecated form
// after
SemgrexPattern p = SemgrexPattern.compile("{} <<nsubj {}"); // current syntax
Defensive patterns

Strategy: validation

Validate before calling

if (pattern.contains(">nsubj") /* example deprecated syntax */) { log.warn("Pattern uses deprecated Semgrex syntax: " + pattern); }

Prevention

When it happens

Trigger: Parsing a Semgrex pattern string containing deprecated syntax (e.g. legacy operators) via SemgrexPattern.compile, which routes through the generated parser and calls warnDeprecated.

Common situations: Old Semgrex patterns written for earlier CoreNLP versions still in use; copied example queries from outdated documentation or codebases; patterns in saved configuration files.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/2be07fce675d6f96. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/semgraph/semgrex/SemgrexParser.java:46

  private String fullExpression(Token startToken) {
    StringBuilder result = new StringBuilder();
    for (Token p = startToken; p != null; p = p.next) {
      if (p.specialToken != null) {
        result.append(p.specialToken.image);
      }
      result.append(p.image);
    }
    return result.toString();
  }

  private void warnDeprecated(String warning, Token startToken) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    (new RuntimeException()).printStackTrace(pw);
    String trace = sw.toString();
    trace = trace.substring(trace.lastIndexOf("SemgrexParser"));
    trace = trace.substring(trace.indexOf("at "));
    log.warn(warning + "\n    " + fullExpression(startToken) + "\n    Current stack: " + trace);
  }

  final public SemgrexPattern Root() throws ParseException {// Root pattern for the semgrex parser.  Doesn't necessarily represent matching the root.
  SemgrexPattern node;
  Token reverse = null;
  List<SemgrexPattern> children = new ArrayList<SemgrexPattern>();
  Token startToken = null;

  List<String> uniqKeys = null;
  Token nextIdentifier = null;
  // a local variable

// start from 1 since we haven't parsed anything yet
    startToken = getToken(1);
    switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
    case ALIGNRELN:{
      reverse = jj_consume_token(ALIGNRELN);
      node = SubNode(GraphRelation.ALIGNED_ROOT);

View on GitHub (pinned to 1b7edd19c4)