{"record":{"id":"6b6b1148c0e338b6","repo":"grpc/grpc-java","slug":"could-not-parse-httpconnectionmanager-config-from","errorCode":null,"errorMessage":"Could not parse HttpConnectionManager config from ApiListener","messagePattern":"Could not parse HttpConnectionManager config from ApiListener","errorType":"validation","errorClass":"ResourceInvalidException","httpStatus":null,"severity":"error","filePath":"xds/src/main/java/io/grpc/xds/XdsListenerResource.java","lineNumber":126,"sourceCode":"    Listener listener = (Listener) unpackedMessage;\n\n    if (listener.hasApiListener()) {\n      return processClientSideListener(listener, args);\n    } else {\n      return processServerSideListener(listener, args);\n    }\n  }\n\n  private LdsUpdate processClientSideListener(Listener listener, XdsResourceType.Args args)\n      throws ResourceInvalidException {\n    // Unpack HttpConnectionManager from the Listener.\n    HttpConnectionManager hcm;\n    try {\n      hcm = unpackCompatibleType(\n          listener.getApiListener().getApiListener(), HttpConnectionManager.class,\n          TYPE_URL_HTTP_CONNECTION_MANAGER, null);\n    } catch (InvalidProtocolBufferException e) {\n      throw new ResourceInvalidException(\n          \"Could not parse HttpConnectionManager config from ApiListener\", e);\n    }\n    return LdsUpdate.forApiListener(\n        parseHttpConnectionManager(hcm, filterRegistry, true /* isForClient */, args));\n  }\n\n  private LdsUpdate processServerSideListener(Listener proto, XdsResourceType.Args args)\n      throws ResourceInvalidException {\n    Set<String> certProviderInstances = null;\n    if (args.getBootstrapInfo() != null && args.getBootstrapInfo().certProviders() != null) {\n      certProviderInstances = args.getBootstrapInfo().certProviders().keySet();\n    }\n    return LdsUpdate.forTcpListener(parseServerSideListener(proto,\n        (TlsContextManager) args.getSecurityConfig(),\n        filterRegistry, certProviderInstances, args));\n  }\n\n  @VisibleForTesting","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/XdsListenerResource.java#L108-L144","documentation":"For client-side (api_listener-based) Listeners, gRPC unpacks the ApiListener's api_listener Any into an HttpConnectionManager. If the Any cannot be unpacked (wrong type URL or invalid bytes), the Listener is rejected with 'Could not parse HttpConnectionManager config from ApiListener'.","triggerScenarios":"Listener.api_listener.api_listener Any does not decode to envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager (wrong type_url such as an HCM filter chain or a different filter config, or malformed serialized bytes); unpackCompatibleType throws InvalidProtocolBufferException.","commonSituations":"Control plane serves a filter-chain config where an HttpConnectionManager is expected; hand-written bootstrap/LDS payloads with wrong Any contents; proto version skew producing incompatible serialized HCM.","solutions":["Ensure api_listener Any carries an HttpConnectionManager message with the correct v3 type URL","Inspect the Any type_url from the management server to confirm what was packed","Fix proto version skew between control plane and gRPC client (v3 HCM expected)","Re-serialize and re-push the corrected Listener resource"],"exampleFix":"// before\napi_listener { api_listener { type_url: \"type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HcmConfig\" ... } }\n// after\napi_listener { api_listener { type_url: \"type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager\" ... } }","handlingStrategy":"validation","validationCode":"// Control-plane side: ensure api_listener Any unpacks to HttpConnectionManager\ntry {\n  listener.getApiListener().getApiListener()\n      .unpack(io.envoyproxy.envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.class);\n} catch (InvalidProtocolBufferException e) {\n  throw new IllegalStateException(\"ApiListener is not an HCM: \"\n      + listener.getApiListener().getApiListener().getTypeUrl(), e);\n}","typeGuard":"boolean isHttpConnectionManagerAny(com.google.protobuf.Any any) {\n  try {\n    return any.is(io.envoyproxy.envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.class);\n  } catch (InvalidProtocolBufferException e) {\n    return false;\n  }\n}","tryCatchPattern":"// Client side: flag unparseable ApiListener configs from watcher errors\n@Override public void onError(Status error) {\n  if (error.getDescription().contains(\"Could not parse HttpConnectionManager config from ApiListener\")) {\n    logger.log(WARNING, \"Bad api_listener in LDS resource: \" + error.getDescription());\n  }\n}","preventionTips":["Pack the HCM with Any.pack(httpConnectionManager) to guarantee the correct type_url","Confirm the control plane does not wrap other network filters where HCM is required","Keep envoy extensions protos (HCM) version-aligned with the client","Test LDS payloads against grpc-java xDS interop tests before rollout"],"tags":["grpc","xds","lds","http-connection-manager","protobuf"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}