{"record":{"id":"b157e73dc3ddce12","repo":"aeron-io/aeron","slug":"aeron-client-must-use-a-rethrowingerrorhandler","errorCode":null,"errorMessage":"Aeron client must use a RethrowingErrorHandler","messagePattern":"Aeron client must use a RethrowingErrorHandler","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/Archive.java","lineNumber":1372,"sourceCode":"                if (null == errorCounter)\n                {\n                    if (NULL_VALUE !=\n                        ArchiveCounters.find(aeron.countersReader(), ARCHIVE_ERROR_COUNT_TYPE_ID, archiveId))\n                    {\n                        throw new ArchiveException(\"found existing archive for archiveId=\" + archiveId);\n                    }\n                    errorCounter = ArchiveCounters.allocateErrorCounter(aeron, tempBuffer, archiveId);\n                }\n            }\n            else if (!aeron.context().useConductorAgentInvoker())\n            {\n                throw new ArchiveException(\n                    \"Aeron client instance must set Aeron.Context.useConductorInvoker(true)\");\n            }\n\n            if (!(aeron.context().subscriberErrorHandler() instanceof RethrowingErrorHandler))\n            {\n                throw new ArchiveException(\"Aeron client must use a RethrowingErrorHandler\");\n            }\n\n            Objects.requireNonNull(errorCounter, \"Error counter must be supplied if aeron client is\");\n\n            if (null == countedErrorHandler)\n            {\n                countedErrorHandler = new CountedErrorHandler(errorHandler, errorCounter);\n            }\n\n            if (null == threadFactory)\n            {\n                threadFactory = Thread::new;\n            }\n\n            if (null == recorderThreadFactory)\n            {\n                recorderThreadFactory = threadFactory;\n            }","sourceCodeStart":1354,"sourceCodeEnd":1390,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/Archive.java#L1354-L1390","documentation":"Archive requires that the Aeron client's subscriber error handler is a RethrowingErrorHandler so that subscriber errors surface to the archive instead of being silently logged/defaulted. Archive throws ArchiveException at startup if aeron.context().subscriberErrorHandler() is not a RethrowingErrorHandler.","triggerScenarios":"Launching Archive with an Aeron client whose Context has a custom subscriberErrorHandler set (or left default) that is not RethrowingErrorHandler.","commonSituations":"Applications installing a logging ErrorHandler globally, then reusing the same Aeron client for the archive; copying client setup code that sets errorHandler(...) for normal subscriptions.","solutions":["Set .rethrowErrorHandler() (or subscriberErrorHandler(new RethrowingErrorHandler())) on the Aeron.Context used for the archive's client.","If a custom handler is required elsewhere, create a separate Aeron client for Archive with the rethrowing handler.","Check whether a shared error-handler factory is overriding the archive client's context."],"exampleFix":"// before\nAeron aeron = Aeron.connect(new Aeron.Context().errorHandler(myLoggingHandler));\n// after\nAeron aeron = Aeron.connect(new Aeron.Context()\n    .errorHandler(myLoggingHandler)\n    .subscriberErrorHandler(new RethrowingErrorHandler()));","handlingStrategy":"validation","validationCode":"if (!(aeron.context().subscriberErrorHandler() instanceof RethrowingErrorHandler))\n{\n    throw new IllegalArgumentException(\"Aeron client for Archive must use RethrowingErrorHandler\");\n}","typeGuard":"boolean hasRethrowingHandler(Aeron aeron) {\n    return aeron.context().subscriberErrorHandler() instanceof RethrowingErrorHandler;\n}","tryCatchPattern":null,"preventionTips":["Do not install custom subscriber error handlers on the archive's Aeron client","Use separate Aeron clients for archive and general pub/sub with different error handling needs"],"tags":["aeron","archive","error-handling","configuration"],"backgroundTag":"invalid-config-value","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"}