"A strange and unexplainable error occurred while trying to create a new sketch"

I’ve just installed v4.2 and now I’m getting the error below when I try to start Processing. However, I I choose “Run as administrator” (I’m running under Windows 10), it starts normally. So I assume it has something to do with permissions, but I don’t have this problem with the older version, v4.0.1, that I still have installed. Would v4.2 and v4.0.1 be writing to different folders?

I found another post about this error (https://discourse.processing.org/t/on-startup-thats-new-to-me-a-strange-and-unexplainable-error-occurred/40899), but this person was running under Linux, so the solution isn’t applicable in my case.

I can try to remember to run it “as administrator” every time, but I know I’ll forget sometimes, and it’s a little annoying having to do that. Did anyone else have this problem under Windows? Any suggestions?

BTW, I love the error message. I always thought there was an explanation whenever software fails, but I guess this is unexplainable.

1 Like

Hi @David,

This is probably a permission error on Windows. Does this happen every time you try to create a sketch?

btw: it says it’s unexplainable but the exception is described just below: Could not create directory ... :wink:

1 Like

Right, that’s what I said. It happens every time I open the Processing IDE (unless I run it “as administrator”). The strange thing is that it doesn’t happen with the earlier version I had installed. That makes no sense, unless they’re writing to different directories.

Edit: Oh, BTW, I have no problem creating a sub-directory in that directory using WIndows Explorer, while logged in as the same user. Which makes no sense either.

It was meant as a joke, but if you want to take it seriously, then the message is self-contradictory. It says it’s unexplainable, but then gives an explanation.

1 Like

You can see the source code here:

The handleNew method is used to create a new untitled document and the Could not create directory IOException is raised when creating the folder and it’s parents:

You can try to do it yourself:

import java.io.*;

File f = new File("C:/Users/user/AppData/Local/Temp/processing/....");

if (!f.mkdirs()) {
  println("Failed creating the folder(s)");
1 Like

That doesn’t explain why I’m getting the error, when I don’t get the error with the earlier version of Processing (v4.0.1). I see now that v4.2 is using a different version of Java, but I don’t see what difference that would make.

Here’s your test (modified to run as a stand-alone Java Program), run under the version of Java that was installed with v4.0.1 of Processing. It doesn’t get the error.

Here’s the same program, run under the same user id., under the version of Java that was installed with v4.2 of Processing. It does get the error.

Does that make any sense to you?

Hi @David,

Have you deleted the whatever in between the two calls above? Mkdirs returns true only if the directory is created by the call. Also means it return false if the directory already exists …

Other thing which came to my mind on this, is a scenario on which the first call of processing is done by administrator, so the parent directory (…Temp\processing) would be created under administrator permissions. After that a call as regular user maybe can’t create a sub directory (Temp/processing/whatever) anymore, as long as an administrative user not allowed it, resp. set the permission to allow to write for anybody to the (…/Temp/processing) directory.
In this case just delete the (…/Temp/processing) directory and start processing as a regular user to let the directory created again under the regular user. In that case regular and administrative user can write to it, resp. create sub directories…

— mnse

1 Like

I ran the test that failed first, so there was nothing to delete. And I ran both tests as a regular user, because the problem doesn’t occur when I run Processing as administrator.

I’ll try deleting the parent directory and see if that fixes the problem.

Edit: No, it didn’t. I’m still getting the same error.


maybe you can change your example to use: java.nio.file.Files.createDirectories
and see if there is a similar behaviour as on Files.mkdirs

— mnse

OK, but why? Doesn’t Processing use Files.mkdirs()? At least, that’s what @josephh seems to be saying?


Just to test if there is a general issue creating the files by jdk 17.0.6 you are using for processing 4.2.
I think it depends on your environment, otherwise we would have much more posts of this topic (also find nothing on github issue page for this problem).
The nio function also have a bit more specific exception handling under the hood so it maybe can lead to any hints to solve the issue …

— mnse

I’m using the jdk that was installed automatically with Processing 4.2 (I just downloaded the zip file for Windows, extracted the contents and moved it to another location). I don’t have any other jdk installed, except for the one that was installed in Processing 4.0.1. Neither of which are in the Windows path variable (you can see which version of the jdk is being found in the screen prints above).

Just out of curiosity, though, I’ll give it a try later (have to go out soon).

Same result.

With jdk that was bundled with Processing 4.0.1:

With jdk that was bundled with Processing 4.2:

And FWIW, I have no trouble creating a folder in that location with Python, or creating one
“manually” with Windows Explorer.