{"record":{"id":"6b95ebac742c2f24","repo":"stanfordnlp/CoreNLP","slug":"no-foot-node-found-for-auxtree","errorCode":null,"errorMessage":"No foot node found for \" + auxTree","messagePattern":"No foot node found for \" \\+ auxTree","errorType":"exception","errorClass":"TsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/trees/tregex/tsurgeon/CreateSubtreeNode.java","lineNumber":41,"sourceCode":"\n  public CreateSubtreeNode(TsurgeonPattern start, TsurgeonPattern end, AuxiliaryTree tree) {\n    super(\"combineSubtrees\",\n      (end == null) ? new TsurgeonPattern[] { start } : new TsurgeonPattern[] { start, end });\n\n    this.auxTree = tree;\n    findFoot();\n  }\n\n  /**\n   * We want to support a command syntax where a simple node label can\n   * be given (i.e., without using a tree literal).\n   *\n   * Check if this syntax is being used, and simulate a foot if so.\n   */\n  private void findFoot() {\n    if (auxTree.foot == null) {\n      if (!auxTree.tree.isLeaf())\n        throw new TsurgeonParseException(\"No foot node found for \" + auxTree);\n\n      // Pretend this leaf is a foot node\n      auxTree.foot = auxTree.tree;\n    }\n  }\n\n  @Override\n  public TsurgeonMatcher matcher(Map<String,Tree> newNodeNames, CoindexationGenerator coindexer) {\n    return new Matcher(newNodeNames, coindexer);\n  }\n\n  private class Matcher extends TsurgeonMatcher {\n    public Matcher(Map<String,Tree> newNodeNames, CoindexationGenerator coindexer) {\n      super(CreateSubtreeNode.this, newNodeNames, coindexer);\n    }\n\n    /**\n     * Combines all nodes between start and end into one subtree, then","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/tregex/tsurgeon/CreateSubtreeNode.java#L23-L59","documentation":"CreateSubtreeNode.findFoot checks the operation's auxiliary tree for a foot node. Tsurgeon supports a single-leaf aux tree shorthand with no explicit foot, but if the aux tree has more than one node and no foot node ('@' marker), the operation cannot know where to attach and throws TsurgeonParseException.","triggerScenarios":"A 'createSubtree' Tsurgeon operation whose auxTree is a multi-node subtree lacking any '@' foot marker; findFoot() runs when CreateSubtreeNode is constructed.","commonSituations":"Writing createSubtree with a multi-branch replacement subtree and forgetting the '@' on the node under which matched children should be inserted; adapting a single-node example (where foot simulation is allowed) to a larger tree.","solutions":["Add '@' to exactly one node label in the createSubtree aux tree to designate the foot/attachment point.","If the intent is a simple single-leaf wrapper, ensure the aux tree is a single leaf node — the foot is then simulated automatically.","Validate the Tsurgeon script syntax so the auxiliary tree parses with its foot marker intact."],"exampleFix":"// before\ncreateSubtree {SBAR {NP the dog}}\n// after\ncreateSubtree {SBAR {@NP the dog}}","handlingStrategy":"validation","validationCode":"static boolean auxTreeOk(String auxTreeString) {\n  boolean hasFoot = auxTreeString.indexOf('@') >= 0;\n  boolean isSingleLeaf = !auxTreeString.matches(\".*\\\\{.*\\\\{.*\"); // rough check: multi-node needs a foot\n  return hasFoot || isSingleLeaf;\n}","typeGuard":null,"tryCatchPattern":"try {\n  Tsurgeon.parseOperation(\"createSubtree \" + auxSpec);\n} catch (TsurgeonParseException e) {\n  throw new IllegalArgumentException(\"createSubtree aux tree needs a '@' foot node: \" + auxSpec, e);\n}","preventionTips":["Only multi-branch auxiliary trees need '@'; single-leaf wrappers may omit it.","Add the foot marker when generalizing a single-node example to a larger subtree.","Parse all Tsurgeon operations at startup so bad scripts fail fast."],"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"}