{"record":{"id":"b548996b3ecbef76","repo":"aeron-io/aeron","slug":"aeronarchive-context-messageretryattempts-must-be-0-got","errorCode":null,"errorMessage":"AeronArchive.Context.messageRetryAttempts must be > 0, got: ","messagePattern":"AeronArchive\\.Context\\.messageRetryAttempts must be > 0, got: ","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java","lineNumber":3111,"sourceCode":"            if (null == controlRequestChannel)\n            {\n                throw new ConfigurationException(\"AeronArchive.Context.controlRequestChannel must be set\");\n            }\n\n            if (null == controlResponseChannel)\n            {\n                throw new ConfigurationException(\"AeronArchive.Context.controlResponseChannel must be set\");\n            }\n\n            if (clientName.length() > Aeron.Configuration.MAX_CLIENT_NAME_LENGTH)\n            {\n                throw new ConfigurationException(\n                    \"AeronArchive.Context.clientName length must be <= \" + Aeron.Configuration.MAX_CLIENT_NAME_LENGTH);\n            }\n\n            if (messageRetryAttempts <= 0)\n            {\n                throw new ConfigurationException(\"AeronArchive.Context.messageRetryAttempts must be > 0, got: \" +\n                    messageRetryAttempts);\n            }\n\n            if (null == aeron)\n            {\n                aeron = Aeron.connect(\n                    new Aeron.Context()\n                        .aeronDirectoryName(aeronDirectoryName)\n                        .clientName(clientName.isEmpty() ? \"archive-client\" : clientName)\n                        .errorHandler(errorHandler)\n                        .subscriberErrorHandler(RethrowingErrorHandler.INSTANCE));\n                ownsAeronClient = true;\n            }\n\n            final ChannelUri requestChannel = applyDefaultParams(controlRequestChannel);\n            final ChannelUri responseChannel = applyDefaultParams(controlResponseChannel);\n            if (!CONTROL_MODE_RESPONSE.equals(responseChannel.get(MDC_CONTROL_MODE_PARAM_NAME)))\n            {","sourceCodeStart":3093,"sourceCodeEnd":3129,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/AeronArchive.java#L3093-L3129","documentation":"Context.conclude() validates that messageRetryAttempts, the number of retries for control protocol requests/responses, is strictly positive. A value of 0 or negative means the retry mechanism would be disabled or infinite/degenerate, so ConfigurationException reports the offending value.","triggerScenarios":"Calling context.messageRetryAttempts(0) or a negative value (e.g. from a misparsed property io.aeron.archive.client.message.retry.attempts) before connect().","commonSituations":"Properties file containing messageRetryAttempts=0; parsing config strings with Integer.parseInt producing -1 on error; code copying a 'disable retries' flag into the attempts setter.","solutions":["Set a positive value, e.g. ctx.messageRetryAttempts(3), before connect().","Fix the properties file/system property so io.aeron.archive.client.message.retry.attempts parses to a positive integer.","Validate the parsed number at config-load time and fall back to AeronArchive.Configuration.MESSAGE_RETRY_ATTEMPTS_DEFAULT on bad input.","Log the configured value before connect() to catch bad parsing early."],"exampleFix":"// before\nctx.messageRetryAttempts(Integer.parseInt(props.getProperty(\"archive.retry\", \"0\")));\n// after\nint retries = Integer.parseInt(props.getProperty(\"archive.retry\", \"3\"));\nctx.messageRetryAttempts(Math.max(1, retries));","handlingStrategy":"validation","validationCode":"int r = ctx.messageRetryAttempts(); if (r <= 0) { ctx.messageRetryAttempts(AeronArchive.Configuration.MESSAGE_RETRY_ATTEMPTS_DEFAULT); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp parsed retry values with Math.max(1, value) at config load time.","Never encode 'disable' as 0; retries are mandatory in the protocol client.","Unit-test config parsing so bad values surface before connect().","Log the effective messageRetryAttempts value at startup."],"tags":["aeron","archive","configuration","validation"],"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"}