{"record":{"id":"be5f281d43b8727c","repo":"aeron-io/aeron","slug":"expected-schemaid-recordingeventsadapter","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/RecordingEventsAdapter.java","lineNumber":77,"sourceCode":"     * @return the number of fragments read during the operation. Zero if no events are available.\n     */\n    public int poll()\n    {\n        return subscription.poll(this, fragmentLimit);\n    }\n\n    /**\n     * {@inheritDoc}\n     */\n    @Override\n    public void onFragment(final DirectBuffer buffer, final int offset, final int length, final Header header)\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        switch (messageHeaderDecoder.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                listener.onStart(\n                    recordingStartedDecoder.recordingId(),\n                    recordingStartedDecoder.startPosition(),\n                    recordingStartedDecoder.sessionId(),\n                    recordingStartedDecoder.streamId(),\n                    recordingStartedDecoder.channel(),\n                    recordingStartedDecoder.sourceIdentity());","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/RecordingEventsAdapter.java#L59-L95","documentation":"RecordingEventsAdapter.onFragment validates the SBE MessageHeader schemaId of each recording-event fragment against MessageHeaderDecoder.SCHEMA_ID. If the event stream delivers messages from a different schema (wrong channel content, version skew between client and archive), it throws ArchiveException('expected schemaId=..., actual=...').","triggerScenarios":"A fragment on the recording events subscription has a header schemaId != MessageHeaderDecoder.SCHEMA_ID — e.g. the events channel/stream receives data from an archive running a different SBE schema, or a non-archive publisher shares the stream.","commonSituations":"Recording events listener attached to a stream also used by other applications; client/server archive version mismatch after an upgrade; misconfigured RecordingEventsPoller/adapter wired to the wrong endpoint.","solutions":["Upgrade/align aeron-archive client and archive agent to the same version.","Dedicate the recording events channel/stream to archive events only.","Check ChannelUri streamId used for the events subscription matches the archive driver's configuration."],"exampleFix":"// before\n// events subscription pointing at a shared app stream\nAeronArchive.addRecordingEventsPoller(eventsChannel, wrongStreamId);\n\n// after\n// set the archive driver's recording events channel and matching stream id\n// -Daeron.archive.recording.events.channel=aeron:udp?endpoint=localhost:8011\n// subscribe with the same streamId the agent publishes on","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    recordingEventsAdapter.poll();\n} catch (ArchiveException e) {\n    if (e.getMessage().startsWith(\"expected schemaId=\")) {\n        // resubscribe to the correct events channel or upgrade the archive\n    }\n}","preventionTips":["Dedicate the recording events stream to archive events only.","Keep archive client and agent versions synchronized across deployments."],"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"}