{"record":{"id":"d131b0d0db997b94","repo":"grpc/grpc-go","slug":"invalid-config-q-v","errorCode":null,"errorMessage":"invalid config: %q, %v","messagePattern":"invalid config: %q, (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/binarylog/env_config.go","lineNumber":72,"sourceCode":"\t\t\treturn nil\n\t\t}\n\t}\n\treturn l\n}\n\n// fillMethodLoggerWithConfigString parses config, creates TruncatingMethodLogger and adds\n// it to the right map in the logger.\nfunc (l *logger) fillMethodLoggerWithConfigString(config string) error {\n\t// \"\" is invalid.\n\tif config == \"\" {\n\t\treturn errors.New(\"empty string is not a valid method binary logging config\")\n\t}\n\n\t// \"-service/method\", blacklist, no * or {} allowed.\n\tif config[0] == '-' {\n\t\ts, m, suffix, err := parseMethodConfigAndSuffix(config[1:])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid config: %q, %v\", config, err)\n\t\t}\n\t\tif m == \"*\" {\n\t\t\treturn fmt.Errorf(\"invalid config: %q, %v\", config, \"* not allowed in blacklist config\")\n\t\t}\n\t\tif suffix != \"\" {\n\t\t\treturn fmt.Errorf(\"invalid config: %q, %v\", config, \"header/message limit not allowed in blacklist config\")\n\t\t}\n\t\tif err := l.setBlacklist(s + \"/\" + m); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid config: %v\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\t// \"*{h:256;m:256}\"\n\tif config[0] == '*' {\n\t\thdr, msg, err := parseHeaderMessageLengthConfig(config[1:])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid config: %q, %v\", config, err)","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/internal/binarylog/env_config.go#L54-L90","documentation":"Returned by fillMethodLoggerWithConfigString when parsing a blacklist entry (config starting with '-'), parseMethodConfigAndSuffix fails to match the expected service/method format (env_config.go:69-72). The part after '-' must match the regex ^([\\w./]+)/((?:\\w+)|[*])(.+)?$ which requires a 'service/method' structure. The %q is the full config token; %v is the parse error.","triggerScenarios":"A blacklist entry in GRPC_BINARY_LOG_FILTER where the part after '-' does not match 'service/method'. For example, '-Foo' (no slash or method), '-invalid', or '-/Bar' (no service). parseMethodConfigAndSuffix returns 'contains invalid substring' when the regex does not match.","commonSituations":"Typos in blacklist entries in the environment variable. Misunderstanding the required 'service/method' format for blacklist entries.","solutions":["Use the format '-service/method' for blacklist entries (e.g., '-Foo/Bar')","Ensure both service and method parts are present and separated by a forward slash","Validate each comma-separated token against the expected format before setting the env var"],"exampleFix":"# before (malformed blacklist entry)\nexport GRPC_BINARY_LOG_FILTER=\"-Foo\"\n\n# after (valid format)\nexport GRPC_BINARY_LOG_FILTER=\"-Foo/Bar\"","handlingStrategy":"validation","validationCode":"// Validate blacklist entry format before using the config string\nfunc validateBlacklistEntry(entry string) error {\n    if !strings.HasPrefix(entry, \"-\") {\n        return nil\n    }\n    rest := entry[1:]\n    matched, _ := regexp.MatchString(`^[\\w./]+/(?:\\w+|[*])(?:\\{.*\\})?$`, rest)\n    if !matched {\n        return fmt.Errorf(\"blacklist entry %q does not match 'service/method' format\", entry)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the format '-service/method' for all blacklist entries","Ensure both service and method parts are present and separated by '/'","Avoid entries like '-Foo' that omit the method part"],"tags":["grpc","binarylog","config","environment-variables","logging"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}