apache/druid · error · IllegalStateException
Path [%s] does not exist
Error message
Path [%s] does not exist
What it means
createTempDirInLocation wraps Files.createTempDirectory failures into more informative IllegalStateExceptions. When the failure is a NoSuchFileException and the parent directory does not exist, Druid reports 'Path [%s] does not exist' so the user fixes the configured temp location.
Source
Thrown at processing/src/main/java/org/apache/druid/java/util/common/FileUtils.java:487
throw new IAE("Path[%s] is not within directory[%s]", path, directory);
}
return resolvedPath.toFile();
}
@SuppressForbidden(reason = "Files#createTempDirectory")
public static File createTempDirInLocation(final Path parentDirectory, @Nullable final String prefix)
{
try {
final Path tmpPath = Files.createTempDirectory(
parentDirectory,
prefix == null || prefix.isEmpty() ? "druid" : prefix
);
return tmpPath.toFile();
}
catch (IOException e) {
// Some inspection to improve error messages.
if (e instanceof NoSuchFileException && !parentDirectory.toFile().exists()) {
throw new ISE("Path [%s] does not exist", parentDirectory);
} else if ((e instanceof FileSystemException && e.getMessage().contains("Read-only file system"))
|| (e instanceof AccessDeniedException)) {
throw new ISE("Path [%s] is not writable, check permissions", parentDirectory);
} else {
// Well, maybe it was something else.
throw new ISE(e, "Failed to create temporary directory in path [%s]", parentDirectory);
}
}
}
/**
* Create "directory" and all intermediate directories as needed. If the directory is successfully created, or already
* exists, returns quietly. Otherwise, throws an IOException.
*
* Simpler to use than {@link File#mkdirs()}, and more reliable since it is safe from races where two threads try
* to create the same directory at the same time.
*
* The name is inspired by UNIX {@code mkdir -p}, which has the same behavior.View on GitHub (pinned to 9b90983fd2)
Solutions
- Create the parent directory before starting Druid (mkdir -p) or fix the configured path
- Verify the path exists and is writable at startup (add a health check)
- Check mounts in containers/Kubernetes (emptyDir/hostPath actually mounted)
- If the path is intentional but transient, catch ISE and retry after creating the directory
Example fix
// before
druid.segment.cacheLocations=/mnt/vol/tmp # volume not mounted
// after — ensure at startup
Files.createDirectories(Paths.get("/mnt/vol/tmp")); Defensive patterns
Strategy: validation
Validate before calling
Path parent = Path.of(configuredTmpDir);
if (!Files.isDirectory(parent)) {
Files.createDirectories(parent); // or fail fast with a clear startup error
} Try / catch
try {
return FileUtils.createTempDir();
} catch (IllegalStateException e) {
if (e.getMessage() != null && e.getMessage().contains("does not exist")) {
Files.createDirectories(parentDir);
return FileUtils.createTempDir();
}
throw e;
} Prevention
- Verify configured temp paths exist and are writable during service startup
- Ensure volumes are mounted before the process starts in containers
- Watch for aggressive tmp cleaners removing directories at runtime
- Include a temp-dir writability check in health checks
When it happens
Trigger: Calling createTempDirInLocation(parentDirectory, prefix) (or createTempDir configured with a custom java.io.tmpdir/druid.*) where the parent directory is missing, so Files.createTempDirectory throws NoSuchFileException.
Common situations: Configured temp directory on a mount that is not mounted/removed at runtime; typo in the configured tmp path; container where the volume was never created; tmp cleaner deleted the parent.
Related errors
- System property java.io.tmpdir is not set, cannot create tem
- Failed to create temporary directory in path [%s]
- The gRPC query server requires either a Basic or Anonymous a
- Metric [%s] not whitelisted.
- Can't load TrustStore. Truststore path or password is not se
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/96c38877a9fa6204.
Report an issue: GitHub.