stanfordnlp/CoreNLP · error · TsurgeonParseException

Error -- no foot node found for " + originalTreeString

Error message

Error -- no foot node found for " + originalTreeString

What it means

The AuxiliaryTree constructor builds a Tsurgeon auxiliary tree from a parsed subtree. Tsurgeon requires an auxiliary tree to contain a foot node (the '@' marker) when mustHaveFoot is true; if findFootNode returns null the constructor throws TsurgeonParseException.

Solutions

  1. Add a foot node marker '@' to exactly one node label in the auxiliary tree string (e.g. '@NP').
  2. Verify the operation's auxTree argument actually contains the '@' character where the attachment point should be.
  3. If the tree legitimately has no attachment point, pass mustHaveFoot=false when constructing AuxiliaryTree programmatically.

Example fix

// before
tsurgeonArg = "{=root {NP-DTR the dog}}"; // no foot node
// after
tsurgeonArg = "{=root {@NP the dog}}"; // '@' marks the foot node
Defensive patterns

Strategy: validation

Validate before calling

boolean hasExactlyOneFoot(String auxTreeString) {
  int count = 0;
  for (int i = 0; i < auxTreeString.length(); i++) if (auxTreeString.charAt(i) == '@') count++;
  return count >= 1;
}

Try / catch

try {
  AuxiliaryTree aux = new AuxiliaryTree(tree, true);
} catch (TsurgeonParseException e) {
  throw new IllegalArgumentException("Auxiliary tree needs a '@' foot node: " + tree, e);
}

Prevention

When it happens

Trigger: Creating an AuxiliaryTree (e.g. from a 'location(@NP=foo)' style node specification or via Tsurgeon's processing of 'new AuxiliaryTree(tree, true)') with a tree whose labels contain no foot-node escape character '@'.

Common situations: Writing a Tsurgeon script with a Move/CreateSubtree operation whose auxiliary subtree forgot the '@' foot marker; copying an auxiliary tree example and stripping the '@'; programmatically constructing auxiliary trees from trees that never had a foot label.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/trees/tregex/tsurgeon/AuxiliaryTree.java:35

 */
public class AuxiliaryTree  {

  /** A logger for this class */
  private static Redwood.RedwoodChannels log = Redwood.channels(AuxiliaryTree.class);

  private final String originalTreeString;
  final Tree tree;
  Tree foot;
  private final IdentityHashMap<Tree,String> nodesToNames; // no one else should be able to get this one.
  private final Map<String,Tree> namesToNodes; // this one has a getter.


  public AuxiliaryTree(Tree tree, boolean mustHaveFoot) {
    originalTreeString = tree.toString();
    this.tree = tree;
    this.foot = findFootNode(tree);
    if (foot == null && mustHaveFoot) {
      throw new TsurgeonParseException("Error -- no foot node found for " + originalTreeString);
    }
    namesToNodes = Generics.newHashMap();
    nodesToNames = new IdentityHashMap<>();
    initializeNamesNodesMaps(tree);
  }

  private AuxiliaryTree(Tree tree, Tree foot, Map<String, Tree> namesToNodes, String originalTreeString) {
    this.originalTreeString = originalTreeString;
    this.tree = tree;
    this.foot = foot;
    this.namesToNodes = namesToNodes;
    nodesToNames = null;
  }

  public Map<String, Tree> namesToNodes() {
    return namesToNodes;
  }

View on GitHub (pinned to 1b7edd19c4)