JetBrains/intellij-community · error · IOException
error.message.unable.to.create.file
error.message.unable.to.create.file
Error message
Unable to create file ''{0}'' What it means
Thrown (as an IOException) from ConfigFileFactoryImpl.createFile when the parent directories of a descriptor config file cannot be created or the parent cannot be resolved in the VFS after refresh. It wraps FileUtil.createParentDirs failing (permissions, invalid path) or refreshAndFindFileByIoFile returning null. The IOException is caught, logged, and surfaced via a later UI callback.
Source
Thrown at java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileFactoryImpl.java:124
VirtualFile existingFile = fileSystem.refreshAndFindFileByIoFile(file);
if (existingFile != null) {
existingFile.refresh(false, false);
if (!existingFile.isValid()) {
existingFile = null;
}
}
if (existingFile != null && !forceNew) {
return existingFile;
}
try {
String text = getText(templateName, project);
final VirtualFile childData;
if (existingFile == null || existingFile.isDirectory()) {
final VirtualFile virtualFile;
if (!FileUtil.createParentDirs(file) ||
(virtualFile = fileSystem.refreshAndFindFileByIoFile(file.getParentFile())) == null) {
throw new IOException(IdeBundle.message("error.message.unable.to.create.file", file.getPath()));
}
childData = virtualFile.createChildData(this, file.getName());
}
else {
childData = existingFile;
}
VfsUtil.saveText(childData, text);
return childData;
}
catch (final IOException e) {
LOG.info(e);
ApplicationManager.getApplication().invokeLater(
() -> Messages.showErrorDialog(JavaUiBundle.message("message.text.error.creating.deployment.descriptor", e.getLocalizedMessage()),
JavaUiBundle.message("message.text.creating.deployment.descriptor")));
}
return null;
}
View on GitHub (pinned to be881553f2)
Solutions
- Check the path from the message: ensure its parent can be created (no file blocking it, no permission issue)
- Fix filesystem permissions or move the project/config dir to a writable location
- Delete a stale plain file occupying the intended parent-directory path and retry
- Check idea.log (LOG.info of the caught IOException) for the underlying OS error
Defensive patterns
Strategy: try-catch
Validate before calling
File parent = file.getParentFile();
if (parent != null && (parent.exists() && !parent.isDirectory())) {
// fail early: parent path occupied by a regular file
}
if (parent != null && !parent.canWrite() && !parent.mkdirs()) {
// fail early: cannot create parent directories
} Try / catch
try { factory.createFile(...); } catch (IOException e) { LOG.info(e); /* surface 'Unable to create file <path>' with retry/choose-another-path actions */ } Prevention
- Pre-create config directories before generation
- Keep projects on writable local filesystems
- Check idea.log for the underlying IOException cause when the generic message appears
When it happens
Trigger: Calling ConfigFileFactory.createFile with a File whose parent directory is not creatable — read-only parent, a parent path that is actually a file, or a path the VFS cannot find after refresh. Happens when a plugin/module descriptor config file is first generated.
Common situations: Project located on a read-only or network mount; leftover file where a directory is expected; path length or character restrictions on Windows; antivirus locking directories during creation.
Related errors
- "Failed to load " + scriptFile
- Row index: %d. Error during nested table row creation: row i
- Column number: %d. Error during retrieving value from nested
- Column number: %d. Error during setting value in nested tabl
- Column index: %d. Error during nested table column creation:
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/0c85cd68347b37b0.
Report an issue: GitHub.