Try restarting your device. This seems a stupid solution but it solved this problem in my app in my nexus device.
What happened to me when I was testing my app before was, it is working/downloading the file then i'll delete it then redownload it for several times, then suddenly it would crash and throw this error saying that unable to create directory but has been creating/using that already.
this is how I use it in my code
public static String downloadPath = "/My-Folder-Name";
File fileDir = new File(downloadPath);
if (fileDir.isDirectory()) {
request.setDestinationInExternalPublicDir(downloadPath, filename);
} else {
fileDir.mkdirs();
request.setDestinationInExternalPublicDir(downloadPath, filename);
}
I'm not sure if this bug is because the SSD storage of the device is failing that's why when I restart the device it works again, then would throw an error again after many times of downloading or when the device hasn't restarted for a while.