{"record":{"id":"b48cf4c2781509d8","repo":"aeron-io/aeron","slug":"expected-schemaid-recordingeventspoller","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/RecordingEventsPoller.java","lineNumber":150,"sourceCode":"\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public ControlledFragmentHandler.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 RecordingStartedDecoder.TEMPLATE_ID:\n                recordingStartedDecoder.wrap(\n                    buffer,\n                    offset + MessageHeaderDecoder.ENCODED_LENGTH,\n                    messageHeaderDecoder.blockLength(),\n                    messageHeaderDecoder.version());\n\n                recordingId = recordingStartedDecoder.recordingId();\n                recordingStartPosition = recordingStartedDecoder.startPosition();\n                recordingPosition = recordingStartPosition;\n                recordingStopPosition = Aeron.NULL_VALUE;\n                isPollComplete = true;\n                return ControlledFragmentHandler.Action.BREAK;","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/RecordingEventsPoller.java#L132-L168","documentation":"RecordingEventsPoller.onFragment wraps each fragment's header with MessageHeaderDecoder and requires schemaId == MessageHeaderDecoder.SCHEMA_ID. Any other schemaId means the poller received data that is not an archive recording-event message, so it throws ArchiveException('expected schemaId=..., actual=...') instead of misinterpreting the payload.","triggerScenarios":"Fragment delivered to the poller's subscription whose SBE header schemaId differs from the archive protocol schema — wrong subscription channel/stream, non-archive publisher on the stream, or archive/client built from different schema versions.","commonSituations":"Sharing the recording events stream with other traffic; version mismatch between the embedded archive client and the archive media driver after dependency upgrade; pointing the poller at a control response channel by mistake.","solutions":["Ensure the poller subscribes to the correct recording events channel and streamId.","Match Aeron Archive client and archive agent versions (identical SBE schema).","Remove or relocate any other publishers writing to that stream."],"exampleFix":"// before\nfinal RecordingEventsPoller poller = new RecordingEventsPoller(\n    ctx.aeron().addSubscription(\"aeron:udp?endpoint=localhost:9999\", 1), // wrong stream\n    listener);\n\n// after\nfinal RecordingEventsPoller poller = new RecordingEventsPoller(\n    ctx.aeron().addSubscription(eventsChannelUri, recordingEventsStreamId),\n    listener);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    while (recordingEventsPoller.poll() == 0 && !isDone()) {\n        idleStrategy.idle();\n    }\n} catch (ArchiveException e) {\n    if (e.getMessage().startsWith(\"expected schemaId=\")) {\n        // stop polling, verify events channel/streamId and versions\n    }\n}","preventionTips":["Verify the events subscription's channel and streamId against the archive driver configuration at startup.","Run a version handshake (ping the archive) before relying on event polling."],"tags":["aeron-archive","sbe","protocol-mismatch"],"backgroundTag":"unexpected-response-shape","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"}