{"record":{"id":"3153513def5e3749","repo":"prestodb/presto","slug":"error-creating-temporary-directory-local-shuffle","errorCode":null,"errorMessage":"Error creating temporary directory 'local_shuffle'.","messagePattern":"Error creating temporary directory 'local_shuffle'\\.","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"critical","filePath":"presto-spark-base/src/main/java/com/facebook/presto/spark/execution/shuffle/PrestoSparkLocalShuffleInfoTranslator.java","lineNumber":44,"sourceCode":"import static java.util.Objects.requireNonNull;\n\npublic class PrestoSparkLocalShuffleInfoTranslator\n        implements PrestoSparkShuffleInfoTranslator\n{\n    private final String localShuffleRootPath;\n    private final JsonCodec<PrestoSparkLocalShuffleReadInfo> readInfoJsonCodec;\n    private final JsonCodec<PrestoSparkLocalShuffleWriteInfo> writeInfoJsonCodec;\n\n    @Inject\n    public PrestoSparkLocalShuffleInfoTranslator(\n            JsonCodec<PrestoSparkLocalShuffleReadInfo> readInfoJsonCodec,\n            JsonCodec<PrestoSparkLocalShuffleWriteInfo> writeInfoJsonCodec)\n    {\n        try {\n            this.localShuffleRootPath = Files.createTempDirectory(\"local_shuffle\").toAbsolutePath().toString();\n        }\n        catch (IOException e) {\n            throw new UncheckedIOException(\"Error creating temporary directory 'local_shuffle'.\", e);\n        }\n        this.readInfoJsonCodec = requireNonNull(readInfoJsonCodec, \"readInfoJsonCodec is null\");\n        this.writeInfoJsonCodec = requireNonNull(writeInfoJsonCodec, \"writeInfoJsonCodec is null\");\n    }\n\n    @Override\n    public PrestoSparkLocalShuffleWriteInfo createShuffleWriteInfo(Session session, PrestoSparkShuffleWriteDescriptor writeDescriptor)\n    {\n        // TODO: Determine sortedShuffle from PartitionAndSerializeNode plan metadata (sortingOrders/sortingKeys).\n        // Requires extending PrestoSparkShuffleWriteDescriptor or maintaining shuffleId->sortedShuffle mapping.\n        boolean sortedShuffle = false;\n        return new PrestoSparkLocalShuffleWriteInfo(writeDescriptor.getNumPartitions(), session.getQueryId().getId(), writeDescriptor.getShuffleHandle().shuffleId(), localShuffleRootPath, sortedShuffle);\n    }\n\n    @Override\n    public PrestoSparkLocalShuffleReadInfo createShuffleReadInfo(Session session, PrestoSparkShuffleReadDescriptor readDescriptor)\n    {\n        // TODO: Determine sortedShuffle from write-side metadata or shuffle descriptor.","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spark-base/src/main/java/com/facebook/presto/spark/execution/shuffle/PrestoSparkLocalShuffleInfoTranslator.java#L26-L62","documentation":"PrestoSparkLocalShuffleInfoTranslator's constructor creates a base temporary directory named 'local_shuffle' via Files.createTempDirectory for local shuffle staging. If the filesystem refuses the directory creation (IOException), it throws UncheckedIOException with the message \"Error creating temporary directory 'local_shuffle'.\" because local shuffle cannot function without it.","triggerScenarios":"Constructing PrestoSparkLocalShuffleInfoTranslator calls Files.createTempDirectory(\"local_shuffle\") against the default temp-dir filesystem; any IOException (no permission, no space, read-only FS, non-existent java.io.tmpdir) surfaces as this UncheckedIOException at PrestoSparkLocalShuffleInfoTranslator.java:44.","commonSituations":"Executors running with a read-only root filesystem or no writable java.io.tmpdir, disk full on the temp volume, restrictive umask/permissions for the Spark process user, or containers with tiny tmpfs.","solutions":["Ensure java.io.tmpdir points to a writable directory with sufficient space for the Spark process","Free disk space on the temp volume or increase container tmpfs size","Check filesystem permissions/ownership for the user running Spark executors","If the OS restricts temp dirs (e.g., read-only container FS), set java.io.tmpdir to a writable mounted path"],"exampleFix":"// before\nspark.executor.extraJavaOptions=  # default tmpdir unwritable\n// after\nspark.executor.extraJavaOptions=-Djava.io.tmpdir=/mnt/writable/spark-tmp","handlingStrategy":"validation","validationCode":"Path tmp = Paths.get(System.getProperty(\"java.io.tmpdir\"));\nif (!Files.isDirectory(tmp) || !Files.isWritable(tmp)) {\n    throw new IllegalStateException(\"Temp dir not writable: \" + tmp);\n}","typeGuard":null,"tryCatchPattern":"try {\n    translator = new PrestoSparkLocalShuffleInfoTranslator(readCodec, writeCodec);\n} catch (UncheckedIOException e) {\n    // Inspect e.getCause() (IOException) for disk full / permission denied\n}","preventionTips":["Point java.io.tmpdir at a writable, adequately-sized volume","Monitor temp disk usage on executors","Avoid read-only container root filesystems without a writable tmp mount"],"tags":["filesystem","io","temp-directory","spark","shuffle"],"backgroundTag":"temp-dir-creation-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}