{"record":{"id":"bffea14e90701927","repo":"aeron-io/aeron","slug":"not-connected","errorCode":null,"errorMessage":"not connected","messagePattern":"not connected","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java","lineNumber":512,"sourceCode":"     */\n    public void checkForErrorResponse()\n    {\n        lock.lock();\n        try\n        {\n            ensureConnected();\n\n            final ControlResponsePoller poller = controlResponsePoller;\n            if (!poller.subscription().isConnected())\n            {\n                state(State.DISCONNECTED);\n                if (null != context.errorHandler())\n                {\n                    context.errorHandler().onError(new ArchiveException(NOT_CONNECTED_MSG));\n                }\n                else\n                {\n                    throw new ArchiveException(NOT_CONNECTED_MSG);\n                }\n            }\n            else if (poller.poll() != 0 && poller.isPollComplete())\n            {\n                if (poller.controlSessionId() == controlSessionId)\n                {\n                    if (poller.code() == ControlResponseCode.ERROR)\n                    {\n                        final ArchiveException ex = new ArchiveException(\n                            poller.errorMessage(),\n                            (int)poller.relevantId(),\n                            poller.correlationId());\n\n                        if (null != context.errorHandler())\n                        {\n                            context.errorHandler().onError(ex);\n                        }\n                        else","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java#L494-L530","documentation":"AeronArchive's control-response poller detects that the control session is no longer connected and raises ArchiveException(NOT_CONNECTED_MSG). If the client has a context errorHandler, the error is delivered there instead of being thrown. It indicates the archive control channel connection was lost, so requests cannot be serviced.","triggerScenarios":"Calling any AeronArchive API (addRecordedPublication, startRecording, pollForResponse, etc.) while the underlying control subscription/publication is not connected — e.g. the archive process is down, the control channel URI is wrong, or the session has been closed/timed out.","commonSituations":"Archive agent not running or crashed; control-request channel misconfigured (wrong endpoint/host); archive restarted and the client session invalidated; network partition between client and archive.","solutions":["Verify the archive is running and reachable at the configured control channel before issuing requests","Wait for connection: AeronArchive.connect() retries internally; ensure the control channel URI (aeron.dir, control endpoints) matches the archive's configuration","Catch ArchiveException and reconnect via AeronArchive.connect() with an errorHandler to receive not-connected notifications instead of thrown exceptions"],"exampleFix":"// before\nAeronArchive archive = AeronArchive.connect(new AeronArchive.Context().aeronDirectoryName(aeronDir));\narchive.startRecording(channel, streamId, SourceLocation.LOCAL); // throws if control session dropped\n// after\nAeronArchive archive = AeronArchive.connect(new AeronArchive.Context()\n    .aeronDirectoryName(aeronDir)\n    .errorHandler(ex -> log.warn(\"archive not connected\", ex)));\nif (archive.controlSessionId() != -1) archive.startRecording(channel, streamId, SourceLocation.LOCAL);","handlingStrategy":"try-catch","validationCode":"// ensure control channel publications/subscription are connected before use\n// e.g. check archiveProxy.controlPublication().isConnected() and controlResponsePoller subscription isConnected()","typeGuard":null,"tryCatchPattern":"try {\n    archiveProxyOrClient.doArchiveCall();\n} catch (ArchiveException ex) {\n    if (ArchiveException.NOT_CONNECTED_MSG.equals(ex.getMessage())) {\n        archive = AeronArchive.connect(ctx); // re-establish session\n    }\n}","preventionTips":["Health-check the archive process before issuing control requests","Configure an errorHandler on the archive Context so not-connected is delivered as a callback, not a throw","Match control channel URIs and aeron.dir between client and archive"],"tags":["network","connection","aeron-archive"],"backgroundTag":"connection-refused","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"}