{"record":{"id":"e8dc745d6217de3f","repo":"aeron-io/aeron","slug":"expected-schemaid-controlresponsepoller","errorCode":null,"errorMessage":"expected schemaId=","messagePattern":"expected schemaId=","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/ControlResponsePoller.java","lineNumber":275,"sourceCode":"    public byte[] encodedChallenge()\n    {\n        return encodedChallenge;\n    }\n\n    ControlledFragmentAssembler.Action onFragment(\n        final DirectBuffer buffer, final int offset, final int length, final Header header)\n    {\n        if (isPollComplete)\n        {\n            return ControlledFragmentHandler.Action.ABORT;\n        }\n\n        messageHeaderDecoder.wrap(buffer, offset);\n\n        final int schemaId = messageHeaderDecoder.schemaId();\n        if (schemaId != MessageHeaderDecoder.SCHEMA_ID)\n        {\n            throw new ArchiveException(\"expected schemaId=\" + MessageHeaderDecoder.SCHEMA_ID + \", actual=\" + schemaId);\n        }\n\n        templateId = messageHeaderDecoder.templateId();\n        switch (templateId)\n        {\n            case ControlResponseDecoder.TEMPLATE_ID:\n            {\n                controlResponseDecoder.wrap(\n                    buffer,\n                    offset + MessageHeaderEncoder.ENCODED_LENGTH,\n                    messageHeaderDecoder.blockLength(),\n                    messageHeaderDecoder.version());\n\n                controlSessionId = controlResponseDecoder.controlSessionId();\n                correlationId = controlResponseDecoder.correlationId();\n                relevantId = controlResponseDecoder.relevantId();\n                code = controlResponseDecoder.code();\n                version = controlResponseDecoder.version();","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/ControlResponsePoller.java#L257-L293","documentation":"ControlResponsePoller.onFragment wraps each polled fragment with MessageHeaderDecoder and throws ArchiveException when the schemaId is not the archive control protocol's schema id. The poller only understands archive control responses, so fragments with a different schema are rejected rather than misinterpreted.","triggerScenarios":"Polling a subscription whose fragments carry a MessageHeader schemaId other than MessageHeaderDecoder.SCHEMA_ID — typically foreign SBE messages on the polled stream or a protocol-version mismatch between the poller's codecs and the sender's.","commonSituations":"Sharing one recording-event/control stream between archive control messages and application messages; mixed aeron-archive versions in the same cluster; hand-rolled publishers using a custom SBE schema on the polled channel.","solutions":["Use matching aeron-archive versions on both ends so schema ids agree","Isolate the control-response stream from non-archive publishers","Check the recorded schemaId in the exception against your codec's MessageHeaderDecoder.SCHEMA_ID","Regenerate codecs from the correct SBE schema if you maintain a fork"],"exampleFix":"// before\npoller.poll(); // throws on any foreign-schema fragment\n\n// after\nif (poller.poll() > 0 && !poller.isPollComplete()) {\n    // handle only after verifying schema inside your own wrapper\n}","handlingStrategy":"validation","validationCode":"messageHeaderDecoder.wrap(buffer, offset);\nif (messageHeaderDecoder.schemaId() != MessageHeaderDecoder.SCHEMA_ID) {\n    log.warn(\"skipping foreign fragment, schemaId=\" + messageHeaderDecoder.schemaId());\n    return;\n}","typeGuard":"boolean isControlFragment(DirectBuffer buffer, int offset) {\n    messageHeaderDecoder.wrap(buffer, offset);\n    return messageHeaderDecoder.schemaId() == MessageHeaderDecoder.SCHEMA_ID;\n}","tryCatchPattern":"try {\n    poller.poll();\n} catch (ArchiveException e) {\n    if (e.getMessage().startsWith(\"expected schemaId=\")) {\n        log.error(\"control poller got non-archive-schema fragment\", e);\n    }\n}","preventionTips":["Poll only streams dedicated to archive control responses","Match aeron-archive versions across all services in the deployment","Version-gate the protocol before adding new message types","Include schemaId in startup diagnostics for the control channel"],"tags":["sbe","schema","protocol-mismatch","poller"],"backgroundTag":"schema-validation-failed","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}