grpc/grpc-go · error

extproc: error parsing config

Error message

extproc: error parsing config %v: unknown type %T, want *anypb.Any

What it means

Returned by ParseFilterConfig when the proto.Message passed in is not *anypb.Any. The xDS resolver is expected to deliver filter configs as packed Any messages; receiving another type indicates an internal wiring bug in how the filter registry invokes the builder. Hit at ext_proc.go:111.

Solutions

  1. Ensure the caller wraps the config in *anypb.Any (anypb.New(msg)) before invoking ParseFilterConfig.
  2. If you maintain a fork, re-check the httpfilter.Builder contract: config arrives as *anypb.Any.
  3. Reproduce with the stock grpc-go resolver; if it works, the bug is in your integration code.
  4. File a grpc-go issue if this occurs with unmodified grpc-go.

Example fix

// before (internal caller)
cfg, err := b.ParseFilterConfig(extProcMsg)
// after
anyCfg, _ := anypb.New(extProcMsg)
cfg, err := b.ParseFilterConfig(anyCfg)
Defensive patterns

Strategy: type-guard

Type guard

// internal caller: ensure you hand the builder an *anypb.Any
func isAny(m proto.Message) bool {
  _, ok := m.(*anypb.Any)
  return ok
}

Prevention

When it happens

Trigger: Some internal caller invokes builder.ParseFilterConfig with a concrete *v3procfilterpb.ExternalProcessor (or any non-Any type) instead of *anypb.Any. End users essentially never trigger this directly; it surfaces during xDS resource parsing if the httpfilter registry contract is violated.

Common situations: A fork/patch of grpc-go changes the registry to pass unwrapped protos; a test harness constructs the wrong message type; an out-of-tree filter integration misuses the builder API.

Related errors


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

Appendix: source

Thrown at internal/xds/httpfilter/extproc/ext_proc.go:112

// NONE or GRPC. Also ensures that if response body mode is GRPC then response
// trailer mode must be SEND.
func validateBodyProcessingMode(mode *v3procfilterpb.ProcessingMode) error {
	if m := mode.GetRequestBodyMode(); m != v3procfilterpb.ProcessingMode_NONE && m != v3procfilterpb.ProcessingMode_GRPC {
		return fmt.Errorf("extproc: invalid request body mode %v: want %q or %q", m, "NONE", "GRPC")
	}
	if m := mode.GetResponseBodyMode(); m != v3procfilterpb.ProcessingMode_NONE && m != v3procfilterpb.ProcessingMode_GRPC {
		return fmt.Errorf("extproc: invalid response body mode %v: want %q or %q", m, "NONE", "GRPC")
	}
	if mode.GetResponseBodyMode() == v3procfilterpb.ProcessingMode_GRPC && mode.GetResponseTrailerMode() != v3procfilterpb.ProcessingMode_SEND {
		return fmt.Errorf("extproc: invalid response trailer mode %v: must be %q when response body mode is %q", mode.GetResponseTrailerMode(), "SEND", "GRPC")
	}
	return nil
}

func (builder) ParseFilterConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {
	m, ok := cfg.(*anypb.Any)
	if !ok {
		return nil, fmt.Errorf("extproc: error parsing config %v: unknown type %T, want *anypb.Any", cfg, cfg)
	}
	msg := new(v3procfilterpb.ExternalProcessor)
	if err := m.UnmarshalTo(msg); err != nil {
		return nil, fmt.Errorf("extproc: failed to unmarshal config %v: %v", cfg, err)
	}
	if msg.GetProcessingMode() == nil {
		return nil, fmt.Errorf("extproc: missing processing_mode in config %v", cfg)
	}
	if err := validateBodyProcessingMode(msg.GetProcessingMode()); err != nil {
		return nil, err
	}

	if msg.GetGrpcService() == nil {
		return nil, fmt.Errorf("extproc: empty grpc_service provided in config %v", cfg)
	}
	server, err := iextproc.ParseGRPCServiceConfig(msg.GetGrpcService())
	if err != nil {
		return nil, fmt.Errorf("extproc: failed to parse grpc_service %v", err)

View on GitHub (pinned to 0c51461d27)