prestodb/presto · critical · PrestoException
GENERIC_INTERNAL_ERROR
GENERIC_INTERNAL_ERROR
Error message
cannot create cache directory
What it means
FileFragmentResultCacheManager's constructor ensures the configured base directory for the fragment result cache exists by calling Files.createDirectories. If the directory cannot be created due to an IOException (permissions, read-only filesystem, invalid path), it throws GENERIC_INTERNAL_ERROR wrapping the cause.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/FileFragmentResultCacheManager.java:116
this.pagesSerdeFactory = new PagesSerdeFactory(blockEncodingSerde, cacheConfig.getBlockEncodingCompressionCodec());
this.fragmentCacheStats = requireNonNull(fragmentCacheStats, "fragmentCacheStats is null");
this.flushExecutor = requireNonNull(flushExecutor, "flushExecutor is null");
this.removalExecutor = requireNonNull(removalExecutor, "removalExecutor is null");
this.cache = CacheBuilder.newBuilder()
.maximumSize(cacheConfig.getMaxCachedEntries())
.expireAfterAccess(cacheConfig.getCacheTtl().toMillis(), MILLISECONDS)
.removalListener(new CacheRemovalListener())
.recordStats()
.build();
this.inputDataStatsEnabled = cacheConfig.isInputDataStatsEnabled();
File target = Paths.get(baseDirectory.toUri()).toFile();
if (!target.exists()) {
try {
Files.createDirectories(target.toPath());
}
catch (IOException e) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, "cannot create cache directory " + target, e);
}
}
else {
File[] files = target.listFiles();
if (files == null) {
return;
}
this.removalExecutor.submit(() -> Arrays.stream(files).forEach(file -> {
try {
Files.delete(file.toPath());
}
catch (IOException e) {
// ignore
}
}));
}
}View on GitHub (pinned to 55bb57d202)
Solutions
- Create the directory manually and grant the Presto process user write access: mkdir -p <dir> && chown presto:presto <dir>
- Correct fragment-result-cache-base-directory to a valid writable path in the coordinator config
- Check mount/disk health (read-only volume, full disk)
Example fix
// etc/config.properties // before: fragment-result-cache-base-directory=/root/fragment-cache // after fragment-result-cache-base-directory=/var/presto/fragment-cache // shell: mkdir -p /var/presto/fragment-cache && chown presto:presto /var/presto/fragment-cache
Defensive patterns
Strategy: validation
Validate before calling
import java.nio.file.*;
import java.nio.file.attribute.*;
Path dir = Paths.get(cacheBaseDir);
File dirFile = dir.toFile();
if (!dirFile.exists()) {
boolean ok = dirFile.mkdirs();
if (!ok || !Files.isWritable(dir)) {
throw new IllegalStateException("cache dir not creatable/writable: " + dir);
}
} Prevention
- Pre-create fragment-result-cache-base-directory and chown it to the Presto service user
- Avoid paths in read-only containers/volumes; mount a writable volume
- Verify config in staging with the same user/permissions as production
When it happens
Trigger: Server startup with fragment-result-cache-enabled=true where the configured base directory does not exist and cannot be created (bad path, no write permission, disk issue).
Common situations: Misconfigured fragment-result-cache-base-directory pointing to a path owned by another user, a non-writable volume, or a placeholder path in config templates.
Related errors
- JDBC driver class not found: {config.getJdbcDriverName()}
- Unknown file system type:
- EMR File System class not found:
- Unable to query ranger service
- Could not create hudi connector for catalog
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/881eef9198f4c831.
Report an issue: GitHub.