{"record":{"id":"7c7727c276177968","repo":"apache/cassandra","slug":"unable-to-resolve-canonical-path-for","errorCode":null,"errorMessage":"Unable to resolve canonical path for ","messagePattern":"Unable to resolve canonical path for ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/CompactionInfo.java","lineNumber":187,"sourceCode":"            ColumnFamilyStore cfs = ColumnFamilyStore.getIfExists(metadata.id);\n            if (cfs != null)\n                return cfs.getDirectoriesForFiles(sstables);\n        }\n        return Collections.emptyList();\n    }\n\n    public String targetDirectory()\n    {\n        if (targetDirectory == null)\n            return \"\";\n\n        try\n        {\n            return new File(targetDirectory).canonicalPath();\n        }\n        catch (Throwable t)\n        {\n            throw new RuntimeException(\"Unable to resolve canonical path for \" + targetDirectory);\n        }\n    }\n\n    /**\n     * Note that this estimate is based on the amount of data we have left to read - it assumes input\n     * size == output size for a compaction, which is not really true, but should most often provide a worst case\n     * remaining write size. We also scale by the effective compression ratio since total/completed are for the uncompressed size.\n     */\n    public long estimatedRemainingWriteToDiskBytes()\n    {\n        if (unit == Unit.BYTES && tasktype.writesData)\n        {\n            final long total = getTotal();\n            double compressionRatio = total == 0 ? 1 : ((double) totalCompressed / (double)total);\n            return (long)(compressionRatio * (total - getCompleted()));\n        }\n        return 0;\n    }","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java#L169-L205","documentation":"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).","triggerScenarios":"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.","commonSituations":"Data directory removed/moved while compaction was running, NFS/mount issues, disk detached from the instance.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"File dir = new File(targetDirectory);\nif (!dir.exists() || !dir.isDirectory()) throw new IllegalStateException(\"target directory missing: \" + targetDirectory);","typeGuard":null,"tryCatchPattern":"try { String canonical = info.getTargetDirectory(); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Unable to resolve canonical path\")) { checkMountsAndLogs(); } }","preventionTips":["Monitor data directory mounts and filesystem health","Avoid moving/removing data directories on live nodes","Inspect node logs for the original Throwable cause"],"tags":["filesystem","compaction","io"],"backgroundTag":"file-read-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}