{"record":{"id":"3a384901213a986a","repo":"aeron-io/aeron","slug":"failed-to-create-mark-file-dir-markfiledir-getabsolutepath","errorCode":null,"errorMessage":"failed to create mark file dir: ${markFileDir.getAbsolutePath()}","messagePattern":"failed to create mark file dir: (.+?)","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-cluster/src/main/java/io/aeron/cluster/ClusterBackup.java","lineNumber":720,"sourceCode":"            if (null == catchupEndpoint)\n            {\n                throw new ClusterException(\"ClusterBackup.Context.catchupEndpoint must be set\");\n            }\n\n            if (!clusterDir.exists() && !clusterDir.mkdirs())\n            {\n                throw new ClusterException(\"failed to create cluster dir: \" + clusterDir.getAbsolutePath());\n            }\n\n            if (null == markFileDir)\n            {\n                final String dir = ClusteredServiceContainer.Configuration.markFileDir();\n                markFileDir = Strings.isEmpty(dir) ? clusterDir : new File(dir);\n            }\n\n            if (!markFileDir.exists() && !markFileDir.mkdirs())\n            {\n                throw new ArchiveException(\"failed to create mark file dir: \" + markFileDir.getAbsolutePath());\n            }\n\n            if (null == epochClock)\n            {\n                epochClock = SystemEpochClock.INSTANCE;\n            }\n\n            if (Aeron.NULL_VALUE == replicationProgressIntervalNs)\n            {\n                replicationProgressIntervalNs = Math.max(replicationProgressTimeoutNs / 10, 1);\n            }\n\n            if (null == markFile)\n            {\n                final int filePageSize = null != aeron ? aeron.context().filePageSize() :\n                    driverFilePageSize(new File(aeronDirectoryName), epochClock, new CommonContext().driverTimeoutMs());\n                markFile = new ClusterMarkFile(\n                    new File(markFileDir, ClusterMarkFile.FILENAME),","sourceCodeStart":702,"sourceCodeEnd":738,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-cluster/src/main/java/io/aeron/cluster/ClusterBackup.java#L702-L738","documentation":"ClusterBackup.Context.conclude() also ensures the mark file directory exists, defaulting it to the cluster dir or the ClusteredServiceContainer markFileDir configuration. If that directory does not exist and mkdirs() fails, it throws an ArchiveException with the directory's absolute path. Same filesystem failure modes as the cluster dir, but for the backup mark file location.","triggerScenarios":"Concluding a ClusterBackup.Context where markFileDir (explicitly set, or derived from ClusteredServiceContainer.Configuration.markFileDir()) cannot be created by mkdirs().","commonSituations":"Setting markFileDir to a path under a directory owned by another user; read-only container filesystem; typo in the configured path making a nested tree that cannot be created due to a permission gap midway.","solutions":["Fix permissions/ownership on the configured mark file dir path (or its parent).","Set markFileDir explicitly to a writable location, or leave it unset so it defaults to the (already created) cluster dir.","Check the path is not blocked by an existing non-directory file.","In containers, ensure the mounted volume is writable for the running user."],"exampleFix":"// before\nctx.markFileDir(new File(\"/readonly/mark\")); // mkdirs fails\n// after\nctx.markFileDir(new File(\"/var/lib/aeron/cluster-backup/mark\")); // writable","handlingStrategy":"validation","validationCode":"File mfd = markFileDir != null ? markFileDir : clusterDir;\nif (!mfd.exists() && !mfd.getParentFile().canWrite()) { throw new IllegalStateException(\"cannot create mark file dir: \" + mfd); }","typeGuard":"static boolean markFileDirCreatable(File d) { return d.exists() ? d.isDirectory() : d.getParentFile() != null && d.getParentFile().canWrite(); }","tryCatchPattern":"try {\n    ctx.conclude();\n} catch (ArchiveException e) {\n    if (e.getMessage().startsWith(\"failed to create mark file dir\")) { log.error(\"check markFileDir permissions: {}\", e.getMessage()); }\n    throw e;\n}","preventionTips":["Leave markFileDir unset to inherit the writable cluster dir, or set it to a verified writable path","Ensure ClusteredServiceContainer.markFileDir config points to an existing, writable directory","Check for typos causing nested paths that cannot be created"],"tags":["filesystem","directory","permissions","mark-file"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}