grpc/grpc-go · warning

invalid config: %v

Error message

invalid config: %v

What it means

Returned by fillMethodLoggerWithConfigString when the internal setBlacklist call fails for a blacklist entry (env_config.go:80-81). This wraps the conflict errors from setBlacklist: either 'conflicting blacklist rules' (error 270, duplicate blacklist) or 'conflicting method rules' (error 271, method already has a logger). The %v is the underlying conflict error.

Source

Thrown at internal/binarylog/env_config.go:81

	// "" is invalid.
	if config == "" {
		return errors.New("empty string is not a valid method binary logging config")
	}

	// "-service/method", blacklist, no * or {} allowed.
	if config[0] == '-' {
		s, m, suffix, err := parseMethodConfigAndSuffix(config[1:])
		if err != nil {
			return fmt.Errorf("invalid config: %q, %v", config, err)
		}
		if m == "*" {
			return fmt.Errorf("invalid config: %q, %v", config, "* not allowed in blacklist config")
		}
		if suffix != "" {
			return fmt.Errorf("invalid config: %q, %v", config, "header/message limit not allowed in blacklist config")
		}
		if err := l.setBlacklist(s + "/" + m); err != nil {
			return fmt.Errorf("invalid config: %v", err)
		}
		return nil
	}

	// "*{h:256;m:256}"
	if config[0] == '*' {
		hdr, msg, err := parseHeaderMessageLengthConfig(config[1:])
		if err != nil {
			return fmt.Errorf("invalid config: %q, %v", config, err)
		}
		if err := l.setDefaultMethodLogger(&MethodLoggerConfig{Header: hdr, Message: msg}); err != nil {
			return fmt.Errorf("invalid config: %v", err)
		}
		return nil
	}

	s, m, suffix, err := parseMethodConfigAndSuffix(config)
	if err != nil {

View on GitHub (pinned to 0c51461d27)

Solutions

  1. Inspect the wrapped error to determine if it is a duplicate blacklist or a method/logger conflict
  2. Remove the conflicting entry so each method appears only once across blacklist and method rules
  3. Deduplicate entries before composing the final filter string

Example fix

# before: blacklist conflicts with method logger
export GRPC_BINARY_LOG_FILTER="Foo/Bar{m:256},-Foo/Bar"

# after: only one rule per method
export GRPC_BINARY_LOG_FILTER="-Foo/Bar"
Defensive patterns

Strategy: validation

Validate before calling

// Combine all conflict checks for the binary log config string
func validateBinaryLogConfig(s string) error {
    if s == "" {
        return nil
    }
    blacklist := map[string]bool{}
    methods := map[string]bool{}
    for _, part := range strings.Split(s, ",") {
        part = strings.TrimSpace(part)
        if strings.HasPrefix(part, "-") {
            entry := part[1:]
            if brace := strings.Index(entry, "{"); brace >= 0 {
                entry = entry[:brace]
            }
            if blacklist[entry] {
                return fmt.Errorf("duplicate blacklist: %q", entry)
            }
            if methods[entry] {
                return fmt.Errorf("conflict: %q has both logging rule and blacklist", entry)
            }
            blacklist[entry] = true
        } else if !strings.HasPrefix(part, "*") {
            if brace := strings.Index(part, "{"); brace >= 0 {
                part = part[:brace]
            }
            if idx := strings.Index(part, "/"); idx >= 0 && part[idx+1:] != "*" {
                if blacklist[part] {
                    return fmt.Errorf("conflict: %q is blacklisted but has a logging rule", part)
                }
                if methods[part] {
                    return fmt.Errorf("duplicate method rule: %q", part)
                }
                methods[part] = true
            }
        }
    }
    return nil
}

Prevention

When it happens

Trigger: A config string where a blacklist entry for a method conflicts with an existing entry. For example, '-Foo/Bar,Foo/Bar{m:256}' (method already logged) or '-Foo/Bar,-Foo/Bar' (duplicate blacklist). setBlacklist at binarylog.go:153-164 detects the conflict.

Common situations: Contradictory or duplicate entries for the same method in the filter string. Often results from composing config from multiple sources without deduplication.

Related errors


AI-assisted analysis of grpc/grpc-go@0c51461d27 (2026-08-11). Data as JSON: /api/errors/a22dd92b347745ab. Report an issue: GitHub.