apache/cassandra · error · RuntimeException
Unable to resolve canonical path for
Error message
Unable to resolve canonical path for
What it means
CompactionInfo.targetDirectory converts the compaction's target directory to a canonical path; if FileOps.canonicalPath throws for any reason, the Throwable is replaced by this RuntimeException (note the original cause is not chained and the message ends with the path).
Source
Thrown at src/java/org/apache/cassandra/db/compaction/CompactionInfo.java:187
ColumnFamilyStore cfs = ColumnFamilyStore.getIfExists(metadata.id);
if (cfs != null)
return cfs.getDirectoriesForFiles(sstables);
}
return Collections.emptyList();
}
public String targetDirectory()
{
if (targetDirectory == null)
return "";
try
{
return new File(targetDirectory).canonicalPath();
}
catch (Throwable t)
{
throw new RuntimeException("Unable to resolve canonical path for " + targetDirectory);
}
}
/**
* Note that this estimate is based on the amount of data we have left to read - it assumes input
* size == output size for a compaction, which is not really true, but should most often provide a worst case
* remaining write size. We also scale by the effective compression ratio since total/completed are for the uncompressed size.
*/
public long estimatedRemainingWriteToDiskBytes()
{
if (unit == Unit.BYTES && tasktype.writesData)
{
final long total = getTotal();
double compressionRatio = total == 0 ? 1 : ((double) totalCompressed / (double)total);
return (long)(compressionRatio * (total - getCompleted()));
}
return 0;
}View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Verify the data directory exists and is mounted; restart the node if the filesystem recovered.
- Check node logs for the original Throwable preceding this message to find the root cause.
- Repair or re-create the damaged data directory and run a scrub/rebuild if needed.
Defensive patterns
Strategy: try-catch
Validate before calling
File dir = new File(targetDirectory);
if (!dir.exists() || !dir.isDirectory()) throw new IllegalStateException("target directory missing: " + targetDirectory); Try / catch
try { String canonical = info.getTargetDirectory(); } catch (RuntimeException e) { if (e.getMessage().startsWith("Unable to resolve canonical path")) { checkMountsAndLogs(); } } Prevention
- Monitor data directory mounts and filesystem health
- Avoid moving/removing data directories on live nodes
- Inspect node logs for the original Throwable cause
When it happens
Trigger: Computing the target directory of an in-progress compaction (e.g. via compactionstats/JMX) when the underlying filesystem call fails — path no longer exists, I/O error, or permission problem on the directory.
Common situations: Data directory removed/moved while compaction was running, NFS/mount issues, disk detached from the instance.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Failed importing SSTables
- Throwing new Runtime to bypass exception handler when disk i
- FSReadError
- FSWriteError
- FSWriteError
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/7c7727c276177968.
Report an issue: GitHub.