mojira.dev
MC-277487

Game crashes when attempting to create a new world if the saves folder is not writable

If the game is unable to write inside the saves folder in the game's installation folder, the game crashes when clicking "Create New World," or "Singleplayer" if there are no worlds.

How to reproduce:

It would probably be a good idea to test these steps in a newly created installation folder.

  1. Edit the permissions for the game's saves folder so that the current user can't write inside it.

  2. Launch the game.

  3. Click on "Singleplayer."
    → ❌ If you don't have any worlds in this installation, the game crashes after ~3 seconds of preparing to create a world.

  4. If you do have some worlds, click on "Create New World."
    → ❌ The game crashes after ~3 seconds of preparing to create a world.

Expected result:

Some sort of error screen would appear, much like the "out of memory" screen or the "unable to load worlds" screen.

Observed result:

The game crashes.

Stack trace:

java.lang.RuntimeException: Could not create save folder
	at net.minecraft.client.gui.screens.worldselection.WorldCreationUiState.java.lang.String findResultFolder(java.lang.String)(WorldCreationUiState.java:105)
	at net.minecraft.client.gui.screens.worldselection.WorldCreationUiState.void <init>(java.nio.file.Path,net.minecraft.client.gui.screens.worldselection.WorldCreationContext,java.util.Optional,java.util.OptionalLong)(WorldCreationUiState.java:61)
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.void <init>(net.minecraft.client.Minecraft,net.minecraft.client.gui.screens.Screen,net.minecraft.client.gui.screens.worldselection.WorldCreationContext,java.util.Optional,java.util.OptionalLong,net.minecraft.client.gui.screens.worldselection.CreateWorldCallback)(CreateWorldScreen.java:403)
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.void openCreateWorldScreen(net.minecraft.client.Minecraft,net.minecraft.client.gui.screens.Screen,java.util.function.Function,net.minecraft.client.gui.screens.worldselection.WorldCreationContextMapper,net.minecraft.resources.ResourceKey,net.minecraft.client.gui.screens.worldselection.CreateWorldCallback)(CreateWorldScreen.java:374)
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.void openFresh(net.minecraft.client.Minecraft,net.minecraft.client.gui.screens.Screen,net.minecraft.client.gui.screens.worldselection.CreateWorldCallback)(CreateWorldScreen.java:322)
	at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.void openFresh(net.minecraft.client.Minecraft,net.minecraft.client.gui.screens.Screen)(CreateWorldScreen.java:309)
	at net.minecraft.client.gui.screens.worldselection.SelectWorldScreen.void lambda$init$2(net.minecraft.client.gui.components.Button)(SelectWorldScreen.java:54)
	at net.minecraft.client.gui.components.Button.void onPress()(Button.java:96)
	at net.minecraft.client.gui.components.AbstractButton.void onClick(double,double)(AbstractButton.java:43)
	at net.minecraft.client.gui.components.AbstractWidget.boolean mouseClicked(double,double,int)(AbstractWidget.java:141)
	at net.minecraft.client.gui.components.AbstractWidget.void updateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput)(AbstractWidget.java:141)
	at net.minecraft.client.gui.components.events.ContainerEventHandler.boolean mouseClicked(double,double,int)(ContainerEventHandler.java:38)
	at net.minecraft.client.gui.components.events.ContainerEventHandler.void setFocused(net.minecraft.client.gui.components.events.GuiEventListener)(ContainerEventHandler.java:38)
	at net.minecraft.client.MouseHandler.void onPress(long,int,int,int)(MouseHandler.java:114)
	at net.minecraft.client.MouseHandler.void lambda$setup$2(long,int,int,int)(MouseHandler.java:215)
	at net.minecraft.util.thread.BlockableEventLoop.void execute(java.lang.Runnable)(BlockableEventLoop.java:110)
	at net.minecraft.client.MouseHandler.void lambda$setup$3(long,int,int,int)(MouseHandler.java:215)
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.null callback(null)(GLFWMouseButtonCallbackI.java:43)
	at org.lwjgl.system.JNI.null invokeV(null)(JNI.java)
	at org.lwjgl.glfw.GLFW.null glfwWaitEventsTimeout(null)(GLFW.java:3509)
	at com.mojang.blaze3d.systems.RenderSystem.void limitDisplayFPS(int)(RenderSystem.java:186)
	at net.minecraft.client.Minecraft.void runTick(boolean)(Minecraft.java:1374)
	at net.minecraft.client.Minecraft.void run()(Minecraft.java:934)
	at net.minecraft.client.main.Main.void main(java.lang.String[])(Main.java:265)
Caused by: java.nio.file.AccessDeniedException: \AppData\Roaming\.minecraft\installations\temp\saves\World
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.createDirectory(WindowsFileSystemProvider.java:527)
	at java.base/java.nio.file.Files.createDirectory(Files.java:699)
	at net.minecraft.FileUtil.java.lang.String findAvailableName(java.nio.file.Path,java.lang.String,java.lang.String)(FileUtil.java:69)
	at net.minecraft.client.gui.screens.worldselection.WorldCreationUiState.java.lang.String findResultFolder(java.lang.String)(WorldCreationUiState.java:103)
	... 21 more

Attachments

Comments 5

Can confirm in 1.21.2 Pre-Release 2.

On Windows, this can be reproduced by doing the following:

  1. Right-click on the saves folder, then go to Properties and the Security tab.

  2. Click the Edit button, and then Users in the "Group or user names" box.

  3. In the "Permissions for Users" box, scroll down and check the Write checkbox under the Deny heading.

  4. Click OK, and then OK on the Properties window.

[media]

I have this same, but error code is -1073740791
My launcher version is b.3.2.21-2.0.16
I wanted to play minecraft 1.21.1, but i got crash after created world.

@unknown, your issue is tracked at MC-265594.

I can confirm, the error also happen for me when modifying permissions, it would be a good idea to say this./

 

"Unable to create a new world! (Protected directory.)

Please check the directory permissions of the saves directory and make sure you are allowed to edit it.

[LEARN MORE]     [OPEN SAVES]"

With "learn more" redirecting to an article talking about files protection and how to modify that, and "open saves" opening the saves directory.

 

Basically, the game should check at startup directories and files permissions and warn the user (for example in the top right corner with a yellow box sliding away after 7 seconds) about wrong permissions settings in the game's files.

@unknown, the report is already confirmed. Please check the 'Confirmation Status' field at the top of the report before leaving confirmation comments. The confirmations will either be set to 'Community Consensus', or 'Confirmed'.

[Mod] ManosSef

(Unassigned)

Community Consensus

Platform

Normal

Crash

1.21.1, 1.21.2 Pre-Release 1, 1.21.3, 1.21.4

Retrieved