{"record":{"id":"512d52229c6b1dde","repo":"xai-org/x-algorithm","slug":"failed-to-parse-df-signature-s-s","errorCode":null,"errorMessage":"Failed to parse DF signature '%s'%s","messagePattern":"Failed to parse DF signature '(.+?)'(.+?)","errorType":"validation","errorClass":"ParseFailure","httpStatus":null,"severity":"error","filePath":"botmaker/src/java/com/twitter/botmaker/compiler/Parser.java","lineNumber":157,"sourceCode":"    try {\n      root = (Tree) parser.params().getTree();\n    } catch (Exception e) {\n      if (e.getCause() instanceof RecognitionException) {\n        RecognitionException re = (RecognitionException) e.getCause();\n        String extraMsg = \"\";\n        if (re.token != null) {\n          String unexpectedTok = \"<EOF>\";\n          if (re.getUnexpectedType() >= 0) {\n            unexpectedTok = BotMakerParser.tokenNames[re.getUnexpectedType()];\n          }\n          extraMsg = String.format(\n              \": line %d col %d, near token <%s>: unexpected token %s\",\n              re.token.getLine(), re.token.getCharPositionInLine() + 1,\n              re.token.getText(), unexpectedTok);\n        } else if (re.line != 0) {\n          extraMsg = String.format(\": line %d col %d\", re.line, re.charPositionInLine + 1);\n        }\n        throw new ParseFailure(String.format(\n            \"Failed to parse DF signature '%s'%s\", s, extraMsg), re);\n      }\n      throw new ParseFailure(\"unknown parse failure\", e);\n    }\n\n    return buildParams(root);\n  }\n\n  private static ImmutableList<Tuple3<Tree, String, Optional<Tree>>> buildParams(\n      Tree params) throws ParseFailure {\n    ImmutableList.Builder<Tuple3<Tree, String, Optional<Tree>>> ret = ImmutableList.builder();\n    Set<String> argNames = Sets.newHashSet();\n    boolean hasOpt = false;\n    for (int i = 0; i < params.getChildCount(); i++) {\n      Tree arg = params.getChild(i);\n      if (arg.getType() == BotMakerLexer.ARG) {\n        String name = arg.getChild(1).getText();\n        if (arg.getChildCount() == 2 && hasOpt) {","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/botmaker/src/java/com/twitter/botmaker/compiler/Parser.java#L139-L175","documentation":"Thrown by Parser.parseParams when parsing a DF (dataflow/feature) signature string fails at the ANTLR level. Like the sibling errors, it appends line/column and unexpected-token context from the RecognitionException so the failure can be localized within the signature string.","triggerScenarios":"Calling parseParams (or params) with a DF signature containing unexpected tokens: bad argument list syntax, missing separators between args, invalid default-value syntax, or a truncated signature string.","commonSituations":"DF signatures authored by hand or assembled from configs; version upgrades of the grammar that change accepted signature syntax; copy/paste of signatures between environments with hidden character differences.","solutions":["Correct the signature at the reported line/col/near-token location","Verify argument list formatting (commas, parens, optional defaults) against working signatures in the repo/tests","If this started after a grammar change, re-generate or update the signature strings to the new syntax","Catch ParseFailure and report the full signature plus position to the author of the config"],"exampleFix":"// before\nImmutableList<Tuple3<Tree,String,Optional<Tree>>> ps = Parser.parseParams(\"#param(a #param(b\");\n\n// after\ntry {\n  ImmutableList<Tuple3<Tree,String,Optional<Tree>>> ps = Parser.parseParams(sig);\n} catch (ParseFailure pf) {\n  throw new IllegalArgumentException(\"Invalid DF signature: \" + sig, pf);\n}","handlingStrategy":"try-catch","validationCode":"// Reject obviously malformed DF signatures cheaply\nboolean saneSignature(String sig) {\n  return sig != null && sig.startsWith(\"#param\") && looksBalanced(sig);\n}","typeGuard":null,"tryCatchPattern":"try {\n  ImmutableList<Tuple3<Tree,String,Optional<Tree>>> ps = Parser.parseParams(sig);\n} catch (ParseFailure pf) {\n  throw new IllegalArgumentException(\"Invalid DF signature '\" + sig + \"': \" + pf.getMessage(), pf);\n}","preventionTips":["Keep a golden set of valid signatures as tests","Diff signatures when editing configs","Escape or reject user-provided text embedded in signatures"],"tags":["parsing","antlr","signature","botmaker"],"backgroundTag":"parse-error-invalid-syntax","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}