JetBrains/intellij-community · error · CantRunException

Cannot create temporary file

Error message

Cannot create temporary file

What it means

createTempArgsFile calls FileUtil.createTempFile("javadoc_args", null); if that throws IOException the runner wraps it in CantRunException('Cannot create temporary file'). Unlike the FileNotFoundException case, this fires during creation itself — the JVM could not produce a new file in the temp directory at all.

Source

Thrown at java/java-impl/src/com/intellij/javadoc/JavadocGeneratorRunProfile.java:355

      }
      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) {
        throw new CantRunException(JavaBundle.message("javadoc.generate.temp.file.error"), e);
      }
      return argsFile;
    }

    private @Unmodifiable @NotNull List<VirtualFile> findSourceRoots(@NotNull Set<Module> modules) {
      OrderEnumerator sourcePathEnumerator = ProjectRootManager.getInstance(myProject).orderEntries(modules);
      if (!myConfiguration.OPTION_INCLUDE_LIBS) {
        sourcePathEnumerator = sourcePathEnumerator.withoutSdk().withoutLibraries();
      }
      if (!myGenerationOptions.isIncludeTestSource()) {
        sourcePathEnumerator = sourcePathEnumerator.productionOnly();
      }
      return sourcePathEnumerator.getSourcePathsList().getRootDirs();
    }

    private @Unmodifiable @NotNull List<VirtualFile> findClassRoots(@NotNull Set<Module> modules, @NotNull Sdk jdk) {
      OrderEnumerator classPathEnumerator = ProjectRootManager.getInstance(myProject).orderEntries(modules).withoutModuleSourceEntries();
      if (jdk.getSdkType() instanceof JavaSdk) {

View on GitHub (pinned to be881553f2)

Solutions

  1. Verify the temp dir exists and is writable (echo $TMPDIR; touch $TMPDIR/probe) and free space there.
  2. Set a writable temp dir for the IDE: -Djava.io.tmpdir=... in Help | Edit Custom VM Options, then restart.
  3. On CI, mount a larger tmpfs or set TMPDIR to a workspace directory before launching the IDE/Remote Dev build.

Example fix

# CI / launch script
# before: default TMPDIR is a small read-only /tmp

# after
export TMPDIR=/build/idea-tmp && mkdir -p "$TMPDIR"
Defensive patterns

Strategy: fallback

Validate before calling

try {
  File probe = FileUtil.createTempFile("probe", null);
  probe.delete();
} catch (IOException e) {
  // temp dir unusable — redirect java.io.tmpdir or warn before javadoc generation
}

Try / catch

try { FileUtil.createTempFile("javadoc_args", null); } catch (IOException e) { /* set -Djava.io.tmpdir to a writable dir and restart the IDE */ }

Prevention

When it happens

Trigger: FileUtil.createTempFile fails: java.io.tmpdir does not exist, is read-only, the disk/quota is exhausted, or file creation is blocked by policy — and javadoc generation needs its args file.

Common situations: CI containers with tiny read-only /tmp; tmpfs filling up during big generations; macOS/Windows security prompts denying temp writes; TMP/TMPDIR environment variables pointing at removed directories.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/87588028a7f0e4c6. Report an issue: GitHub.