grpc/grpc-java · error · IllegalArgumentException

Invalid input config

Error message

Invalid input config: ${typeUrl}

What it means

The factory getInput unpacks the extension's Any-typed config into HttpRequestHeaderMatchInput. If the Any payload is not actually that message (wrong type_url / corrupted bytes), unpacking fails with InvalidProtocolBufferException, rethrown as IllegalArgumentException naming the typeUrl.

Solutions

  1. Verify the type_url of the typed_config matches the HttpRequestHeaderMatchInput type URL expected by typeUrl().
  2. Regenerate/align proto classes with the xDS control plane's Envoy API version.
  3. Check that the serialized Any payload was produced from HttpRequestHeaderMatchInput, not another message.

Example fix

// before
{"typed_config": {"@type": ".../HttpAttributesCelMatchInput", ...}}
// after
{"typed_config": {"@type": ".../HttpRequestHeaderMatchInput", "header_name": "x-user-id"}}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!"type.googleapis.com/envoy.config.route.v3.HeaderMatchInput".equals(config.getTypedConfig().getTypeUrl())) {
  throw new IllegalArgumentException("wrong extension type: " + config.getTypedConfig().getTypeUrl());
}

Type guard

static boolean isHeaderMatchInput(TypedExtensionConfig config) {
  return config.getTypedConfig().getTypeUrl().endsWith("HeaderMatchInput");
}

Try / catch

try {
  input = factory.getInput(config);
} catch (IllegalArgumentException e) {
  if (e.getCause() instanceof InvalidProtocolBufferException) {
    // wrong type_url or corrupt payload; fix typeUrl before retry
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing a TypedExtensionConfig whose typed_config's typeUrl does not correspond to type.googleapis.com/envoy.config.route.v3.HeaderMatchInput or whose bytes cannot be parsed as HttpRequestHeaderMatchInput.

Common situations: Wrong extension type referenced in route matcher config (e.g. CEL input wired where a header input is expected), stale generated proto classes, or xDS control plane emitting a config for a newer/older Envoy API version.

Understand the failure class

Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.

Related errors


AI-assisted analysis of grpc/grpc-java@64daddc1f3 (2026-09-08). Data as JSON: /api/errors/6d46fe3b065d4961. Report an issue: GitHub.

Appendix: source

Thrown at xds/src/main/java/io/grpc/xds/internal/matcher/HeaderMatchInput.java:104

      return null;
    }
    return String.join(",", values);
  }

  @Override
  public Class<?> outputType() {
    return String.class;
  }

  static final class Provider implements MatchInputProvider {
    @Override
    public HeaderMatchInput getInput(TypedExtensionConfig config) {
      try {
        HttpRequestHeaderMatchInput proto = config.getTypedConfig()
            .unpack(HttpRequestHeaderMatchInput.class);
        return new HeaderMatchInput(proto.getHeaderName());
      } catch (InvalidProtocolBufferException e) {
        throw new IllegalArgumentException(
            "Invalid input config: " + config.getTypedConfig().getTypeUrl(), e);
      }
    }

    @Override
    public String typeUrl() {
      return TYPE_URL;
    }
  }
}

View on GitHub (pinned to 64daddc1f3)