JetBrains/intellij-community · error · CantRunException
Temporary file doesn't exist or cannot be opened
Error message
Temporary file doesn't exist or cannot be opened
What it means
The runner writes the javadoc argument list into a temp args file (referenced via '@argsFile' on the javadoc command line, since command lines can exceed OS limits). If opening that freshly created file for writing throws FileNotFoundException, it is wrapped in CantRunException('Temporary file doesn't exist or cannot be opened'). On a normal system this only happens if the file vanishes between creation and open, or the temp directory denies access.
Source
Thrown at java/java-impl/src/com/intellij/javadoc/JavadocGeneratorRunProfile.java:336
String path = roots.map(MyJavaCommandLineState::localPath).collect(Collectors.joining(File.pathSeparator));
writer.println("-classpath");
writer.println(StringUtil.wrapWithDoubleQuote(path));
if (!sourceRoots.isEmpty() && JavaSdkUtil.isJdkAtLeast(jdk, JavaSdkVersion.JDK_18)) {
//is needed for javadoc snippets only
String sourcePath = sourceRoots.stream().map(MyJavaCommandLineState::localPath).collect(Collectors.joining(File.pathSeparator));
writer.println("--source-path");
writer.println(StringUtil.wrapWithDoubleQuote(sourcePath));
}
}
}
for (VirtualFile source : sources) {
writer.println(StringUtil.wrapWithDoubleQuote(source.getPath()));
}
}
catch (FileNotFoundException e) {
throw new CantRunException(JavaBundle.message("javadoc.generate.temp.file.does.not.exist"), e);
}
catch (CantRunException e) {
FileUtil.delete(argsFile);
throw e;
}
myArgFileFilter.setPath(argsFile.getPath(), cs);
parameters.add("@" + argsFile.getPath());
OSProcessHandler.deleteFileOnTermination(cmdLine, argsFile);
cmdLine.setCharset(cs);
}
private static @NotNull File createTempArgsFile() throws CantRunException {
File argsFile;
try {
argsFile = FileUtil.createTempFile("javadoc_args", null);
}
catch (IOException e) {View on GitHub (pinned to be881553f2)
Solutions
- Free space / permissions on the temp directory and retry generation.
- Point java.io.tmpdir elsewhere via Help | Edit Custom VM Options: add -Djava.io.tmpdir=/path/to/writable/dir and restart.
- Disable or whitelist the tmp-cleaning/security tool for the IDE temp directory.
Example fix
# help > edit custom vm options # before (default) # (java.io.tmpdir unset, points at cleaned /tmp) # after -Djava.io.tmpdir=/home/user/idea-tmp
Defensive patterns
Strategy: fallback
Validate before calling
File tmp = new File(System.getProperty("java.io.tmpdir"));
if (!tmp.canWrite() || tmp.getFreeSpace() < 50L * 1024 * 1024) { /* redirect or warn before generation */ } Try / catch
try { generateJavadoc(...); } catch (CantRunException e) { if (e.getMessage().contains("Temporary file")) { cleanOrRedirectTmp(); retryOnce(); } } Prevention
- Keep the temp directory writable with free space
- Set -Djava.io.tmpdir to a stable private directory for the IDE
- Whitelist the IDE temp dir in antivirus/tmp-cleaner tools
When it happens
Trigger: createTempArgsFile succeeded but new FileOutputStream(argsFile) throws FileNotFoundException — the temp dir (java.io.tmpdir) was cleared, is read-only, full quota, or an antivirus/lock deleted the file instantly.
Common situations: Disk-full conditions on the temp partition; aggressive tmp cleaners (systemd-tmpfiles, CI containers with small tmpfs); security software removing the just-created file; exotic sandboxes where java.io.tmpdir points somewhere unwritable.
Related errors
- Cannot create temporary file
- Cannot generate JavaDoc - no javadoc tool found at {0} or {1
- No JDK specified
- Directory '{0}' doesn't seem to be writeable. Please choose
- Cannot generate JavaDoc - no Java SDK is configured for the
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/937fb005486acb4d.
Report an issue: GitHub.