{"record":{"id":"0ee1155059c3cd02","repo":"apache/kafka","slug":"expected-response-from-controller-endpoint-but-go","errorCode":null,"errorMessage":"Expected response from CONTROLLER endpoint, but got response from endpoint type {endpointType}","messagePattern":"Expected response from CONTROLLER endpoint, but got response from endpoint type (.+?)","errorType":"exception","errorClass":"MismatchedEndpointTypeException","httpStatus":null,"severity":"error","filePath":"clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java","lineNumber":1811,"sourceCode":"                    metadataManager.updateFailed(e);\n                    return false;\n                }\n\n                @Override\n                public void handleFailure(Throwable e) {\n                    metadataManager.updateFailed(e);\n                }\n            };\n        }\n    }\n\n    static Cluster parseDescribeClusterResponse(DescribeClusterResponseData response) {\n        ApiError apiError = new ApiError(response.errorCode(), response.errorMessage());\n        if (apiError.isFailure()) {\n            throw apiError.exception();\n        }\n        if (response.endpointType() != EndpointType.CONTROLLER.id()) {\n            throw new MismatchedEndpointTypeException(\"Expected response from CONTROLLER \" +\n                \"endpoint, but got response from endpoint type \" + (int) response.endpointType());\n        }\n        List<Node> nodes = new ArrayList<>();\n        Node controllerNode = null;\n        for (DescribeClusterResponseData.DescribeClusterBroker node : response.brokers()) {\n            Node newNode = new Node(node.brokerId(), node.host(), node.port(), node.rack());\n            nodes.add(newNode);\n            if (node.brokerId() == response.controllerId()) {\n                controllerNode = newNode;\n            }\n        }\n        return new Cluster(response.clusterId(),\n            nodes,\n            Collections.emptyList(),\n            Collections.emptySet(),\n            Collections.emptySet(),\n            controllerNode);\n    }","sourceCodeStart":1793,"sourceCodeEnd":1829,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L1793-L1829","documentation":"A MismatchedEndpointTypeException thrown while parsing a DescribeClusterResponse when the client expected a response from a CONTROLLER endpoint (because it is using bootstrap.controllers) but the response's endpointType field indicates a different endpoint type. It signals a topology/routing mismatch between what the client asked for and what the cluster returned.","triggerScenarios":"Admin client configured with bootstrap.controllers sending DescribeCluster with endpointType=CONTROLLER, but the responding node reports a non-CONTROLLER endpointType. Happens when a controller-listed address actually routes to a broker, or when the cluster is in a mixed/transitioning state.","commonSituations":"Misconfigured advertised listeners where a controller listener is actually a broker listener; pointing bootstrap.controllers at broker ports by mistake; cluster in the middle of a KRaft controller switch; version skew where endpointType semantics differ.","solutions":["Verify bootstrap.controllers points at controller listener ports (typically 9093), not broker ports.","Check advertised.listeners/controller.quorum.voters on the cluster side to ensure controller endpoints advertise as controllers.","Retry after the cluster stabilizes if the error appeared during a controller failover."],"exampleFix":"// before\nprops.put(\"bootstrap.controllers\", \"host1:9092,host2:9092\"); // broker ports\n\n// after\nprops.put(\"bootstrap.controllers\", \"host1:9093,host2:9093\"); // controller ports","handlingStrategy":"validation","validationCode":"// verify controller ports before relying on bootstrap.controllers\n// (no client-side guard beyond correct config; see preventionTips)","typeGuard":null,"tryCatchPattern":"try {\n    admin.describeCluster(opts).nodes().get();\n} catch (ExecutionException e) {\n    if (e.getCause() instanceof MismatchedEndpointTypeException) {\n        // reconfigure bootstrap.controllers to controller listener ports, retry\n    }\n}","preventionTips":["Point bootstrap.controllers only at controller listener ports (e.g. 9093).","Verify advertised.listeners/controller.quorum.voters match the controller endpoints.","Retry after a controller failover if the error is transient."],"tags":["kafka-admin","kratf","controller","endpoint-mismatch","configuration"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}