{"record":{"id":"0c85cd68347b37b0","repo":"JetBrains/intellij-community","slug":"error-message-unable-to-create-file","errorCode":"error.message.unable.to.create.file","errorMessage":"Unable to create file ''{0}''","messagePattern":"Unable to create file ''(.+?)''","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileFactoryImpl.java","lineNumber":124,"sourceCode":"    VirtualFile existingFile = fileSystem.refreshAndFindFileByIoFile(file);\n    if (existingFile != null) {\n      existingFile.refresh(false, false);\n      if (!existingFile.isValid()) {\n        existingFile = null;\n      }\n    }\n\n    if (existingFile != null && !forceNew) {\n      return existingFile;\n    }\n    try {\n      String text = getText(templateName, project);\n      final VirtualFile childData;\n      if (existingFile == null || existingFile.isDirectory()) {\n        final VirtualFile virtualFile;\n        if (!FileUtil.createParentDirs(file) ||\n            (virtualFile = fileSystem.refreshAndFindFileByIoFile(file.getParentFile())) == null) {\n          throw new IOException(IdeBundle.message(\"error.message.unable.to.create.file\", file.getPath()));\n        }\n        childData = virtualFile.createChildData(this, file.getName());\n      }\n      else {\n        childData = existingFile;\n      }\n      VfsUtil.saveText(childData, text);\n      return childData;\n    }\n    catch (final IOException e) {\n      LOG.info(e);\n      ApplicationManager.getApplication().invokeLater(\n        () -> Messages.showErrorDialog(JavaUiBundle.message(\"message.text.error.creating.deployment.descriptor\", e.getLocalizedMessage()),\n                                     JavaUiBundle.message(\"message.text.creating.deployment.descriptor\")));\n    }\n    return null;\n  }\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileFactoryImpl.java#L106-L142","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"File parent = file.getParentFile();\nif (parent != null && (parent.exists() && !parent.isDirectory())) {\n  // fail early: parent path occupied by a regular file\n}\nif (parent != null && !parent.canWrite() && !parent.mkdirs()) {\n  // fail early: cannot create parent directories\n}","typeGuard":null,"tryCatchPattern":"try { factory.createFile(...); } catch (IOException e) { LOG.info(e); /* surface 'Unable to create file <path>' with retry/choose-another-path actions */ }","preventionTips":["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"],"tags":["intellij","vfs","file-io","config-files","io"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}