{"record":{"id":"39483137898b861a","repo":"aeron-io/aeron","slug":"invalid-errorbufferlength-errorbufferlength-clustermarkfile","errorCode":null,"errorMessage":"Invalid errorBufferLength: <errorBufferLength>","messagePattern":"Invalid errorBufferLength: <errorBufferLength>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/service/ClusterMarkFile.java","lineNumber":138,"sourceCode":"     * @param file              full qualified file to the {@link MarkFile}.\n     * @param type              of cluster component the {@link MarkFile} represents.\n     * @param errorBufferLength for storing the error log.\n     * @param epochClock        for checking liveness against.\n     * @param timeoutMs         for the activity check on an existing {@link MarkFile}.\n     * @param filePageSize      for aligning file length to.\n     * @since 1.48.0\n     */\n    public ClusterMarkFile(\n        final File file,\n        final ClusterComponentType type,\n        final int errorBufferLength,\n        final EpochClock epochClock,\n        final long timeoutMs,\n        final int filePageSize)\n    {\n        if (errorBufferLength < ERROR_BUFFER_MIN_LENGTH || errorBufferLength > ERROR_BUFFER_MAX_LENGTH)\n        {\n            throw new IllegalArgumentException(\"Invalid errorBufferLength: \" + errorBufferLength);\n        }\n\n        LogBufferDescriptor.checkPageSize(filePageSize);\n\n        final boolean markFileExists = file.exists();\n        final int totalFileLength =\n            BitUtil.align(HEADER_LENGTH + errorBufferLength, filePageSize);\n\n        final MessageHeaderDecoder messageHeaderDecoder = new MessageHeaderDecoder();\n\n        final long candidateTermId;\n        if (markFileExists)\n        {\n            final int currentHeaderOffset = headerOffset(file);\n            final MarkFile existingMarkFile = new MarkFile(\n                file,\n                true,\n                currentHeaderOffset + MarkFileHeaderDecoder.versionEncodingOffset(),","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/service/ClusterMarkFile.java#L120-L156","documentation":"ClusterMarkFile's constructor validates that the configured error buffer length is between ERROR_BUFFER_MIN_LENGTH and ERROR_BUFFER_MAX_LENGTH inclusive, throwing IllegalArgumentException otherwise. The error buffer in the mark file has a fixed header layout and a bounded allowed size, so out-of-range values cannot be honored.","triggerScenarios":"Constructing a ClusterMarkFile (directly or via cluster/service configuration) with an errorBufferLength below the minimum or above the maximum, e.g. passing 0, a negative value, or an excessively large buffer.","commonSituations":"Typo in cluster context configuration (e.g. setting bytes to KB), a config file supplying 0, or copying a constant from the wrong unit.","solutions":["Set errorBufferLength to a value within the allowed range (use the library's ERROR_BUFFER_MIN_LENGTH/MAX_LENGTH constants; the default 1MB-style value in ClusterMarkFile is safe).","Check the cluster context property (e.g. clusteredServiceErrorBufferLength) in your configuration for a wrong unit or zero.","Align the value with any existing mark file so an existing header's errorBufferLength is reused consistently."],"exampleFix":"// before\nctx.errorBufferLength(0);\n// after\nctx.errorBufferLength(ERROR_BUFFER_MIN_LENGTH); // e.g. 1024, or the library default","handlingStrategy":"validation","validationCode":"// java\nif (errorBufferLength < ClusterMarkFile.ERROR_BUFFER_MIN_LENGTH ||\n    errorBufferLength > ClusterMarkFile.ERROR_BUFFER_MAX_LENGTH) {\n    throw new IllegalArgumentException(\"errorBufferLength out of range: \" + errorBufferLength);\n}\nclusteredContext.errorBufferLength(errorBufferLength);","typeGuard":null,"tryCatchPattern":"try {\n    ClusterMarkFile markFile = new ClusterMarkFile(file, ...errorBufferLength...);\n} catch (IllegalArgumentException e) {\n    // correct the configured value and retry once with the default\n}","preventionTips":["Use the ERROR_BUFFER_MIN_LENGTH / ERROR_BUFFER_MAX_LENGTH constants instead of hand-picked numbers.","Watch units: sizes are in bytes, not KB/MB.","Log the effective errorBufferLength at startup to catch config regressions early."],"tags":["java","config","validation","illegal-argument"],"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"}