apache/cassandra · error · RuntimeException

NANOSECONDS level precision is not supported.

Error message

NANOSECONDS level precision is not supported.

What it means

Thrown when the 'precision' property in commitlog_archiving.properties resolves to TimeUnit.NANOSECONDS. Cassandra's restore-point-in-time bookkeeping operates at microsecond resolution, so nanosecond precision is explicitly rejected at startup.

Source

Thrown at src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java:157

                    {
                        throw new RuntimeException("Unable to create directory: " + dir);
                    }
                }
            }
        }

        String precisionPropertyValue = commitlogCommands.getProperty("precision", TimeUnit.MICROSECONDS.name());
        TimeUnit precision;
        try
        {
            precision = TimeUnit.valueOf(precisionPropertyValue);
        }
        catch (IllegalArgumentException ex)
        {
            throw new RuntimeException("Unable to parse precision of value " + precisionPropertyValue, ex);
        }
        if (precision == TimeUnit.NANOSECONDS)
            throw new RuntimeException("NANOSECONDS level precision is not supported.");

        String targetTime = commitlogCommands.getProperty("restore_point_in_time");
        long restorePointInTime = Long.MAX_VALUE;
        try
        {
            if (!Strings.isNullOrEmpty(targetTime))
            {
                // get restorePointInTime in microseconds level by default as cassandra use this level's timestamp
                restorePointInTime = getRestorationPointInTimeInMicroseconds(targetTime);
            }
        }
        catch (DateTimeParseException e)
        {
            throw new RuntimeException("Unable to parse restore target time", e);
        }

        String snapshotPosition = commitlogCommands.getProperty("snapshot_commitlog_position");
        CommitLogPosition snapshotCommitLogPosition;

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Change precision to MICROSECONDS (the finest supported value and the default).
  2. Remove the precision property to fall back to the default.
  3. If nanosecond precision is a hard requirement, it is not supported — restructure the restore strategy around microsecond timestamps.

Example fix

# before
precision: NANOSECONDS
# after
precision: MICROSECONDS
Defensive patterns

Strategy: validation

Validate before calling

String p = props.getProperty("precision");
if (p != null && p.trim().equalsIgnoreCase("NANOSECONDS"))
    throw new IllegalArgumentException("precision NANOSECONDS is unsupported; use MICROSECONDS");

Try / catch

try { archiver = CommitLogArchiver.construct(); }
catch (RuntimeException e) {
    if ("NANOSECONDS level precision is not supported.".equals(e.getMessage()))
        log.error("Set precision to MICROSECONDS or lower", e);
    throw e;
}

Prevention

When it happens

Trigger: getArchiverFromProperties() parses precision=NANOSECONDS and hits the explicit `if (precision == TimeUnit.NANOSECONDS)` guard.

Common situations: Developer setting precision to NANOSECONDS expecting higher-resolution restores; auto-generated configs that emit all TimeUnit values.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/9f939fc9ba2b8aac. Report an issue: GitHub.