{"record":{"id":"4e5a788e39ecb99a","repo":"apache/druid","slug":"unable-to-create-marker-file-for-s","errorCode":null,"errorMessage":"Unable to create marker file for [%s]","messagePattern":"Unable to create marker file for \\[(.+?)\\]","errorType":"exception","errorClass":"SegmentLoadingException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java","lineNumber":2427,"sourceCode":"        throws SegmentLoadingException\n    {\n      // We use a marker to prevent the case where a segment is downloaded, but before the download completes,\n      // the parent directories of the segment are removed\n      final File downloadStartMarker = new File(storageDir, DOWNLOAD_START_MARKER_FILE_NAME);\n      try {\n        FileUtils.mkdirp(storageDir);\n\n        if (!downloadStartMarker.createNewFile()) {\n          throw new SegmentLoadingException(\"Was not able to create new download marker for [%s]\", storageDir);\n        }\n        loadInLocation(segment, storageDir);\n\n        if (!downloadStartMarker.delete()) {\n          throw new SegmentLoadingException(\"Unable to remove marker file for [%s]\", storageDir);\n        }\n      }\n      catch (IOException e) {\n        throw new SegmentLoadingException(e, \"Unable to create marker file for [%s]\", storageDir);\n      }\n    }\n\n    @GuardedBy(\"entryLock\")\n    private void loadInLocation(final DataSegment segment, final File storageDir)\n        throws SegmentLoadingException\n    {\n      // LoadSpec isn't materialized until here so that any system can interpret Segment without having to have all the\n      // LoadSpec dependencies.\n      final LoadSpec loadSpec = jsonMapper.convertValue(segment.getLoadSpec(), LoadSpec.class);\n      final LoadSpec.LoadSpecResult result = loadSpec.loadSegment(storageDir);\n      if (result.getSize() != segment.getSize()) {\n        log.warn(\n            \"Segment [%s] is different than expected size. Expected [%d] found [%d]\",\n            segment.getId(),\n            segment.getSize(),\n            result.getSize()\n        );","sourceCodeStart":2409,"sourceCodeEnd":2445,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java#L2409-L2445","documentation":"Thrown when FileUtils.mkdirp(storageDir) or downloadStartMarker.createNewFile() throws an IOException while preparing the segment's storage directory before download. The wrap preserves the IO cause; the marker file could not be created, so the download cannot be safely tracked.","triggerScenarios":"IOException from creating the storage directory or marker file — permission denied on the cache path, disk full, read-only filesystem, or path exists as a non-directory.","commonSituations":"Cache location owned by a different user; volume mounted read-only after hardware failure; location path clobbered by a file instead of directory; ENOSPC on the cache volume.","solutions":["Fix filesystem permissions on the cache location so the Druid process can mkdir and create files (chown/chmod).","Check disk space and inode availability on the cache volume (df -h, df -i).","Verify the location path is a writable directory, not a file or a read-only mount.","Remove any conflicting path at the storageDir location and retry the load."],"exampleFix":"// before: cache dir not writable by druid user\n// drwx------ root root /var/druid/segment-cache\n// after\nchown -R druid:druid /var/druid/segment-cache\nchmod -R u+rwX /var/druid/segment-cache","handlingStrategy":"validation","validationCode":"// pre-flight: location must be a writable directory with free space\nif (!Files.isDirectory(loc) || !Files.isWritable(loc)) throw new IllegalStateException(\"bad cache location: \" + loc);","typeGuard":null,"tryCatchPattern":"try { loadSegment(segment); } catch (SegmentLoadingException e) { if (e.getCause() instanceof IOException io) { log.error(\"marker mkdir/create failed: %s\", io.getMessage()); } }","preventionTips":["Provision cache locations with adequate disk space and correct ownership before starting historicals.","Check df -h/df -i monitoring to catch ENOSPC early.","Verify mount options (not read-only) after hardware maintenance."],"tags":["segment-cache","ioexception","mkdir","permissions","disk-full"],"backgroundTag":"file-write-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}