prestodb/presto · error · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

cannot create cache directory + target

What it means

FileMergeCacheManager constructor validation: the target cache directory (under cache.base-directory) could not be created on the local filesystem (missing permissions, bad path, or IO error), so file-merge caching cannot store data.

Source

Thrown at presto-cache/src/main/java/com/facebook/presto/cache/filemerge/FileMergeCacheManager.java:135

        this.cacheSizeCalculateExecutor = cacheSizeCalculateExecutor;
        this.cache = CacheBuilder.newBuilder()
                .maximumSize(fileMergeCacheConfig.getMaxCachedEntries())
                .expireAfterAccess(fileMergeCacheConfig.getCacheTtl().toMillis(), MILLISECONDS)
                .removalListener(new CacheRemovalListener())
                .recordStats()
                .build();
        this.stats = requireNonNull(stats, "stats is null");
        this.baseDirectory = new Path(cacheConfig.getBaseDirectory());
        checkArgument(fileMergeCacheConfig.getMaxInMemoryCacheSize().toBytes() >= 0, "maxInflightBytes is negative");
        this.maxInflightBytes = fileMergeCacheConfig.getMaxInMemoryCacheSize().toBytes();

        File target = new File(baseDirectory.toUri());
        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.cacheRemovalExecutor.submit(() -> Arrays.stream(files).forEach(file -> {
                try {
                    Files.delete(file.toPath());
                }
                catch (IOException e) {
                    // ignore
                }
            }));
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the cache base directory path is valid and writable
  2. Create the directory manually or fix permissions
  3. Point hive.cache.base-directory at a valid location
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-cache/src/main/java/com/facebook/presto/cache/filemerge/FileMergeCacheManager.java:135 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/4c0621fb1a06966f. Report an issue: GitHub.