{"record":{"id":"35ff46b963b7a4f6","repo":"apache/cassandra","slug":"invalid-folder-descriptor-trying-to-create-log-rep-35ff46","errorCode":null,"errorMessage":"Invalid folder descriptor trying to create log replica {}. Continuing without Native I/O support.","messagePattern":"Invalid folder descriptor trying to create log replica (.+?)\\. Continuing without Native I/O support\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/lifecycle/LogReplica.java","lineNumber":65,"sourceCode":" * @see LogFile\n */\nfinal class LogReplica implements AutoCloseable\n{\n    private static final Logger logger = LoggerFactory.getLogger(LogReplica.class);\n    private static final boolean REQUIRE_FD = !IGNORE_MISSING_NATIVE_FILE_HINTS.getBoolean();\n\n    private final File file;\n    private int directoryDescriptor;\n    private final Map<String, String> errors = new HashMap<>();\n\n    static LogReplica create(File directory, String fileName)\n    {\n        int folderFD = NativeLibrary.tryOpenDirectory(directory.path());\n        if (folderFD == -1  && REQUIRE_FD)\n        {\n            if (DatabaseDescriptor.isClientInitialized())\n            {\n                logger.warn(\"Invalid folder descriptor trying to create log replica {}. Continuing without Native I/O support.\", directory.path());\n            }\n            else\n            {\n                throw new FSReadError(new IOException(String.format(\"Invalid folder descriptor trying to create log replica %s\", directory.path())), directory.path());\n            }\n        }\n\n        return new LogReplica(new File(fileName), folderFD);\n    }\n\n    static LogReplica open(File file)\n    {\n        int folderFD = NativeLibrary.tryOpenDirectory(file.parent().path());\n        if (folderFD == -1)\n        {\n            if (DatabaseDescriptor.isClientInitialized())\n            {\n                logger.warn(\"Invalid folder descriptor trying to create log replica {}. Continuing without Native I/O support.\", file.parentPath());","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/lifecycle/LogReplica.java#L47-L83","documentation":"LogReplica.create tries to open the transaction log directory with NativeLibrary.tryOpenDirectory to obtain a folder file descriptor used to detect hard-link renames. When the FD is -1, behavior depends on context: in a client/tooling process (isClientInitialized) it logs this warning and continues without native I/O support; in a server process it throws FSReadError because the server requires FDs for correct txn-log tracking.","triggerScenarios":"tryOpenDirectory returns -1 for the log directory path — e.g. the directory does not exist, lacks read permission, or the platform lacks the native library (non-Linux/limited seccomp blocking openat) — while REQUIRE_FD is true; run inside a client tool (e.g. sstable tools) to get the warn variant.","commonSituations":"Running Cassandra client tools on macOS/Windows without full native support; containers with restrictive seccomp/AppArmor profiles blocking directory open; data directories mounted with restrictive permissions.","solutions":["If seen in a client tool, ignore — operation continues without native I/O support.","If seen on a server (FSReadError), fix permissions on the data/txn-log directory so the process can open it.","Verify the platform native library is present and seccomp profiles allow open() syscalls on the directory.","Ensure the directory path exists and is a real directory before invoking the tool."],"exampleFix":"// before (docker run with blocking profile)\ndocker run --security-opt seccomp=strict.json cassandra ...\n// after\ndocker run --security-opt seccomp=default.json cassandra ...","handlingStrategy":"validation","validationCode":"// Pre-check the directory is openable before running tools\ntry (java.nio.channels.FileChannel ch = FileChannel.open(Paths.get(dir), StandardOpenOption.READ)) {\n    // directory readable\n}\ncatch (IOException e) {\n    throw new IllegalStateException(\"Cannot open txn log directory: \" + dir, e);\n}","typeGuard":null,"tryCatchPattern":"try { LogReplica.create(file); }\ncatch (FSReadError e) {\n    logger.error(\"Directory FD unavailable: {}\", e.getMessage());\n    // fix permissions / seccomp and retry\n}","preventionTips":["Ensure the Cassandra user owns/readable-permissions on data directories.","Allow directory open() syscalls in container seccomp profiles.","Run client tools on the same platform as the cluster or a supported one."],"tags":["native-io","file-descriptor","permissions","txn-log"],"backgroundTag":"permission-denied","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}