grpc/grpc-go · warning
conflicting global rules found
Error message
conflicting global rules found
What it means
Returned by logger.setDefaultMethodLogger when l.config.All is already non-nil (binarylog.go:114-115). The binary log filter config string contains two global ('*') rules. The first '*' sets l.config.All; the second finds it already set and rejects the duplicate. This error propagates through NewLoggerFromConfigString, which logs a warning and returns nil (disabling all binary logging).
Source
Thrown at internal/binarylog/binarylog.go:115
type logger struct {
config LoggerConfig
}
// NewLoggerFromConfig builds a logger with the given LoggerConfig.
func NewLoggerFromConfig(config LoggerConfig) Logger {
return &logger{config: config}
}
// newEmptyLogger creates an empty logger. The map fields need to be filled in
// using the set* functions.
func newEmptyLogger() *logger {
return &logger{}
}
// Set method logger for "*".
func (l *logger) setDefaultMethodLogger(ml *MethodLoggerConfig) error {
if l.config.All != nil {
return fmt.Errorf("conflicting global rules found")
}
l.config.All = ml
return nil
}
// Set method logger for "service/*".
//
// New MethodLogger with same service overrides the old one.
func (l *logger) setServiceMethodLogger(service string, ml *MethodLoggerConfig) error {
if _, ok := l.config.Services[service]; ok {
return fmt.Errorf("conflicting service rules for service %v found", service)
}
if l.config.Services == nil {
l.config.Services = make(map[string]*MethodLoggerConfig)
}
l.config.Services[service] = ml
return nil
}View on GitHub (pinned to 0c51461d27)
Solutions
- Remove the duplicate '*' entry from the GRPC_BINARY_LOG_FILTER value
- Use only one global rule: '*' or '*{h:256;m:512}'
- Validate the config string by splitting on commas and checking for duplicate '*' entries before setting the env var
Example fix
# before (duplicate global rule) export GRPC_BINARY_LOG_FILTER="*,*" # after (single global rule) export GRPC_BINARY_LOG_FILTER="*"
Defensive patterns
Strategy: validation
Validate before calling
// Validate the GRPC_BINARY_LOG_FILTER string for duplicate global rules
func validateBinaryLogConfig(s string) error {
if s == "" {
return nil
}
globalCount := 0
for _, part := range strings.Split(s, ",") {
if strings.HasPrefix(part, "*") {
globalCount++
}
}
if globalCount > 1 {
return fmt.Errorf("duplicate global '*' rule in config")
}
return nil
} Prevention
- Keep only one '*' entry in the GRPC_BINARY_LOG_FILTER environment variable
- When composing filter strings programmatically, deduplicate global entries
- Test the config string in a staging environment before deploying
When it happens
Trigger: Setting GRPC_BINARY_LOG_FILTER to a string containing two global rules, e.g., '*,*' or '*{h:256},*{m:512}'. fillMethodLoggerWithConfigString processes each comma-separated entry; the second '*' triggers setDefaultMethodLogger which finds All already set.
Common situations: Accidentally duplicating the global rule when editing the GRPC_BINARY_LOG_FILTER environment variable. Copy-pasting a config that already contained '*'.
Related errors
- conflicting service rules for service %v found
- conflicting blacklist rules for method %v found
- conflicting method rules for method %v found
- invalid config: %q, %v
- invalid config: %v
AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11).
Data as JSON: /api/errors/3ef380a2a739e9d4.
Report an issue: GitHub.