{"record":{"id":"ba5d138c9b458b05","repo":"stanfordnlp/CoreNLP","slug":"error-no-foot-node-found-for-originaltreest","errorCode":null,"errorMessage":"Error -- no foot node found for \" + originalTreeString","messagePattern":"Error -- no foot node found for \" \\+ originalTreeString","errorType":"exception","errorClass":"TsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/trees/tregex/tsurgeon/AuxiliaryTree.java","lineNumber":35,"sourceCode":" */\npublic class AuxiliaryTree  {\n\n  /** A logger for this class */\n  private static Redwood.RedwoodChannels log = Redwood.channels(AuxiliaryTree.class);\n\n  private final String originalTreeString;\n  final Tree tree;\n  Tree foot;\n  private final IdentityHashMap<Tree,String> nodesToNames; // no one else should be able to get this one.\n  private final Map<String,Tree> namesToNodes; // this one has a getter.\n\n\n  public AuxiliaryTree(Tree tree, boolean mustHaveFoot) {\n    originalTreeString = tree.toString();\n    this.tree = tree;\n    this.foot = findFootNode(tree);\n    if (foot == null && mustHaveFoot) {\n      throw new TsurgeonParseException(\"Error -- no foot node found for \" + originalTreeString);\n    }\n    namesToNodes = Generics.newHashMap();\n    nodesToNames = new IdentityHashMap<>();\n    initializeNamesNodesMaps(tree);\n  }\n\n  private AuxiliaryTree(Tree tree, Tree foot, Map<String, Tree> namesToNodes, String originalTreeString) {\n    this.originalTreeString = originalTreeString;\n    this.tree = tree;\n    this.foot = foot;\n    this.namesToNodes = namesToNodes;\n    nodesToNames = null;\n  }\n\n  public Map<String, Tree> namesToNodes() {\n    return namesToNodes;\n  }\n","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/tregex/tsurgeon/AuxiliaryTree.java#L17-L53","documentation":"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.","triggerScenarios":"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 '@'.","commonSituations":"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.","solutions":["Add a foot node marker '@' to exactly one node label in the auxiliary tree string (e.g. '@NP').","Verify the operation's auxTree argument actually contains the '@' character where the attachment point should be.","If the tree legitimately has no attachment point, pass mustHaveFoot=false when constructing AuxiliaryTree programmatically."],"exampleFix":"// before\ntsurgeonArg = \"{=root {NP-DTR the dog}}\"; // no foot node\n// after\ntsurgeonArg = \"{=root {@NP the dog}}\"; // '@' marks the foot node","handlingStrategy":"validation","validationCode":"boolean hasExactlyOneFoot(String auxTreeString) {\n  int count = 0;\n  for (int i = 0; i < auxTreeString.length(); i++) if (auxTreeString.charAt(i) == '@') count++;\n  return count >= 1;\n}","typeGuard":null,"tryCatchPattern":"try {\n  AuxiliaryTree aux = new AuxiliaryTree(tree, true);\n} catch (TsurgeonParseException e) {\n  throw new IllegalArgumentException(\"Auxiliary tree needs a '@' foot node: \" + tree, e);\n}","preventionTips":["Always mark exactly one node in a Tsurgeon auxiliary tree with '@'.","Keep the foot marker intact when copying/editing Tsurgeon scripts.","Pass mustHaveFoot=false only when the tree is intentionally foot-less."],"tags":["tsurgeon","tree-manipulation","invalid-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}