{"record":{"id":"1de585b1665357ec","repo":"jenkinsci/jenkins","slug":"failed-to-create-a-temp-directory-on-remote","errorCode":null,"errorMessage":"Failed to create a temp directory on ${remote}","messagePattern":"Failed to create a temp directory on (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/FilePath.java","lineNumber":1717,"sourceCode":"     *      The suffix string to be used in generating the directory's name; may\n     *      be null, in which case the suffix \".tmp\" will be used\n     * @return\n     *      The new FilePath pointing to the temporary directory\n     * @since 1.311\n     * @see Files#createTempDirectory(Path, String, FileAttribute[])\n     */\n    public FilePath createTempDir(final String prefix, final String suffix) throws IOException, InterruptedException {\n        try {\n            String[] s;\n            if (suffix == null || suffix.isBlank()) {\n                s = new String[]{prefix, \"tmp\"}; // see File.createTempFile - tmp is used if suffix is null\n            } else {\n                s = new String[]{prefix, suffix};\n            }\n            String name = String.join(\".\", s);\n            return new FilePath(this, act(new CreateTempDir(name)));\n        } catch (IOException e) {\n            throw new IOException(\"Failed to create a temp directory on \" + remote, e);\n        }\n    }\n\n    private static class CreateTempDir extends MasterToSlaveFileCallable<String> {\n        private final String name;\n\n        CreateTempDir(String name) {\n            this.name = name;\n        }\n\n            private static final long serialVersionUID = 1L;\n\n            @Override\n            public String invoke(File dir, VirtualChannel channel) throws IOException {\n\n                Path tempPath;\n                final boolean isPosix = FileSystems.getDefault().supportedFileAttributeViews().contains(\"posix\");\n","sourceCodeStart":1699,"sourceCodeEnd":1735,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/FilePath.java#L1699-L1735","documentation":"Thrown by FilePath.createTempDir wrapping IOException from the remote CreateTempDir callable (which calls Files.createTempDirectory). The wrapper names the remote path of this FilePath. CreateTempDir joins prefix and suffix (defaulting suffix to 'tmp') and creates a directory with full Posix permissions on POSIX systems.","triggerScenarios":"Parent directory not writable or missing; disk full; prefix contains illegal characters for the filesystem; name too long after joining; permission denied on the target volume.","commonSituations":"Agent workspace on a read-only/full filesystem; very long prefix+suffix exceeding path limits; container mount not writable; agent user lacks permission.","solutions":["Ensure the target directory (this FilePath) exists and is writable.","Free disk space on the agent volume.","Keep prefix short and free of path separators / illegal characters.","Verify the agent user has permission to create directories and set permissions."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"if (!fp.exists()) fp.mkdirs();\nif (!fp.getRemote().equals(remoteValidated)) throw new IllegalArgumentException(\"bad path\");","typeGuard":"null","tryCatchPattern":"try {\n    FilePath d = fp.createTempDir(prefix, suffix);\n} catch (IOException e) {\n    // 'Failed to create a temp directory' — disk full, perms, or path too long\n}","preventionTips":["Ensure the parent directory is writable and has free space.","Keep prefix+suffix short to avoid filesystem path limits.","Confirm the agent user can create directories with the requested permissions."],"tags":["temp-dir","filesystem","agent"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}