aeron-io/aeron · error · ConfigurationException

existing max write time counter detected for archiveId=

Error message

existing max write time counter detected for archiveId=${archiveId}

What it means

To avoid duplicate recording max-write-time counters for the same archiveId (e.g. from a previous archive instance that did not clean up), Archive checks the counters reader for an existing counter with ARCHIVE_RECORDER_MAX_WRITE_TIME_TYPE_ID and the given archiveId. If one already exists and no counter was supplied, Archive throws ConfigurationException.

Solutions

  1. Use a unique archiveId, or ensure the previous archive instance was fully closed so its counters are released.
  2. Restart the media driver to clear stale counters if a crashed process left them behind.
  3. Explicitly supply the existing maxWriteTimeCounter via Archive.Context if intentional reuse is desired.

Example fix

// before
Archive.launch(new Archive.Context().archiveId(42)); // stale counter for 42 exists
// after
Archive.launch(new Archive.Context().archiveId(System.nanoTime())); // or ensure old archive closed
Defensive patterns

Strategy: try-catch

Validate before calling

int existing = ArchiveCounters.find(aeron.countersReader(),
    ArchiveCounters.ARCHIVE_RECORDER_MAX_WRITE_TIME_TYPE_ID, archiveId);
if (existing != Aeron.NULL_VALUE)
{
    archiveId = generateNewArchiveId(); // pick an unused id before launch
}

Try / catch

try {
    Archive.launch(ctx.archiveId(archiveId));
} catch (ConfigurationException e) {
    if (e.getMessage().contains("existing max write time counter")) {
        // retry with a fresh archiveId after closing the stale archive
    }
}

Prevention

When it happens

Trigger: Starting a second Archive (or restarting without the driver's counter cleanup) using the same archiveId while the old max-write-time counter is still live in the driver's counter buffer.

Common situations: Rapid restart of an embedded archive against a still-running media driver; launching two archive instances with a clashing archiveId.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12). Data as JSON: /api/errors/6234d7ad3596dafb. Report an issue: GitHub.

Appendix: source

Thrown at aeron-archive/src/main/java/io/aeron/archive/Archive.java:1593

            if (null == replaySessionCounter)
            {
                replaySessionCounter = ArchiveCounters.allocate(
                    aeron,
                    tempBuffer,
                    ARCHIVE_REPLAY_SESSION_COUNT_TYPE_ID,
                    "Archive Replay Sessions",
                    archiveId);
            }
            validateCounterTypeId(aeron, replaySessionCounter, ARCHIVE_REPLAY_SESSION_COUNT_TYPE_ID);

            if (null == maxWriteTimeCounter)
            {
                final int counterId = ArchiveCounters.find(
                    aeron.countersReader(), ARCHIVE_RECORDER_MAX_WRITE_TIME_TYPE_ID, archiveId);
                if (NULL_VALUE != counterId)
                {
                    throw new ConfigurationException(
                        "existing max write time counter detected for archiveId=" + archiveId);
                }

                maxWriteTimeCounter = ArchiveCounters.allocate(
                    aeron,
                    tempBuffer,
                    ARCHIVE_RECORDER_MAX_WRITE_TIME_TYPE_ID,
                    "archive-recorder max write time in ns",
                    archiveId);
            }
            validateCounterTypeId(aeron, maxWriteTimeCounter, ARCHIVE_RECORDER_MAX_WRITE_TIME_TYPE_ID);

            if (null == totalWriteBytesCounter)
            {
                totalWriteBytesCounter = ArchiveCounters.allocate(
                    aeron,
                    tempBuffer,
                    ARCHIVE_RECORDER_TOTAL_WRITE_BYTES_TYPE_ID,

View on GitHub (pinned to 6d60124e15)