{"record":{"id":"35e9b7c597784c88","repo":"grpc/grpc-java","slug":"illegal-log-config-pattern","errorCode":null,"errorMessage":"Illegal log config pattern: ","messagePattern":"Illegal log config pattern: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"services/src/main/java/io/grpc/protobuf/services/BinlogHelper.java","lineNumber":629,"sourceCode":"      checkNotNull(sink, \"sink\");\n      BinlogHelper globalLog = null;\n      Map<String, BinlogHelper> perServiceLogs = new HashMap<>();\n      Map<String, BinlogHelper> perMethodLogs = new HashMap<>();\n      Set<String> blacklistedMethods = new HashSet<>();\n      if (configurationString != null && configurationString.length() > 0) {\n        for (String configuration : Splitter.on(',').split(configurationString)) {\n          int leftCurly = configuration.indexOf('{');\n          // '*' for global, 'service/*' for service glob, or 'service/method' for fully qualified\n          String methodOrSvc;\n          // An expression originally wrapped in curly braces; like {m:256,h:256}, {m:256}, {h:256}\n          String binlogOptionStr;\n          if (leftCurly == -1) {\n            methodOrSvc = configuration;\n            binlogOptionStr = null;\n          } else {\n            int rightCurly = configuration.indexOf('}', leftCurly);\n            if (rightCurly != configuration.length() - 1) {\n              throw new IllegalArgumentException(\"Illegal log config pattern: \" + configuration);\n            }\n            methodOrSvc = configuration.substring(0, leftCurly);\n            // option without the curly braces\n            binlogOptionStr = configuration.substring(leftCurly + 1, configuration.length() - 1);\n          }\n          if (methodOrSvc.isEmpty()) {\n            throw new IllegalArgumentException(\"Illegal log config pattern: \" + configuration);\n          }\n          if (methodOrSvc.equals(\"*\")) {\n            // parse config for \"*\"\n            checkState(\n                globalLog == null,\n                \"Duplicate entry, this is fatal: \" + configuration);\n            globalLog = createBinaryLog(sink, binlogOptionStr);\n            logger.log(Level.INFO, \"Global binlog: {0}\", binlogOptionStr);\n          } else if (isServiceGlob(methodOrSvc)) {\n            // parse config for a service, e.g. \"service/*\"\n            String service = MethodDescriptor.extractFullServiceName(methodOrSvc);","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/services/src/main/java/io/grpc/protobuf/services/BinlogHelper.java#L611-L647","documentation":"FactoryImpl's per-configuration parser throws IllegalArgumentException('Illegal log config pattern: ' + configuration) when a configuration entry contains an opening '{' whose closing '}' is not the last character of the entry, i.e. trailing characters exist after the option braces.","triggerScenarios":"Passing a binary-log config entry like 'svc/Method{h}extra' (characters after '}') to FactoryImpl used by GRPC_BINARY_LOG_CONFIG parsing.","commonSituations":"Typos in the binary log env var, concatenating entries without a proper separator, or copy-paste errors leaving stray characters after braces.","solutions":["Make the '}' the last character of the entry: 'Service/Method{h:2;m:100}'","Separate multiple entries with ',' instead of appending directly","Remove stray trailing characters after the closing brace"],"exampleFix":"// before\n\"my.Service/MyMethod{h:2}x\"\n// after\n\"my.Service/MyMethod{h:2}\"","handlingStrategy":"validation","validationCode":"for (String entry : config.split(\",\")) {\n  int open = entry.indexOf('{');\n  if (open != -1 && entry.indexOf('}') != entry.length() - 1) {\n    throw new IllegalStateException(\"Trailing chars after '}': \" + entry);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  BinlogHelper h = new BinlogHelper.FactoryImpl(sink, configStr);\n} catch (IllegalArgumentException e) {\n  // message echoes the offending configuration; fix and retry once\n}","preventionTips":["Make '}' the last character of every entry","Separate entries with ',' instead of concatenating","Lint the config string with a regex before setting it"],"tags":["grpc","binary-log","configuration","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}