{"record":{"id":"3667eb1f5b13250d","repo":"pentaho/pentaho-kettle","slug":"unable-to-create-directory","errorCode":null,"errorMessage":"unable to create directory: ","messagePattern":"unable to create directory: ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"plugins/pentaho-googledrive-vfs/core/src/main/java/org/pentaho/googledrive/vfs/util/CustomDataStoreFactory.java","lineNumber":50,"sourceCode":"import java.util.Collections;\nimport java.util.Set;\nimport java.util.concurrent.locks.Lock;\nimport java.util.concurrent.locks.ReentrantLock;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Iterator;\n\npublic class CustomDataStoreFactory extends AbstractDataStoreFactory {\n\n  private final File dataDirectory;\n\n  public CustomDataStoreFactory( File dataDirectory ) throws IOException {\n    dataDirectory = dataDirectory.getCanonicalFile();\n    this.dataDirectory = dataDirectory;\n    if ( IOUtils.isSymbolicLink( dataDirectory ) ) {\n      throw new IOException( \"unable to use a symbolic link: \" + dataDirectory );\n    } else if ( !dataDirectory.exists() && !dataDirectory.mkdirs() ) {\n      throw new IOException( \"unable to create directory: \" + dataDirectory );\n    }\n  }\n\n  protected <V extends Serializable> DataStore<V> createDataStore( String id ) throws IOException {\n    return new CustomDataStore( this, this.dataDirectory, id );\n  }\n\n  static class CustomDataStore<V extends Serializable> extends AbstractDataStore<V> {\n    private File dataFile = null;\n    private File dataDirectory = null;\n    private HashMap<String, byte[]> keyValueMap = Maps.newHashMap();\n    private final Lock lock = new ReentrantLock();\n\n    CustomDataStore( CustomDataStoreFactory dataStore, File dataDirectory, String id ) throws IOException {\n      super( dataStore, id );\n      this.dataDirectory = dataDirectory;\n      this.dataFile = new File( this.dataDirectory, getId() );\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pentaho-googledrive-vfs/core/src/main/java/org/pentaho/googledrive/vfs/util/CustomDataStoreFactory.java#L32-L68","documentation":"CustomDataStoreFactory's constructor calls dataDirectory.mkdirs() when the directory does not exist; if mkdirs() returns false the factory throws IOException 'unable to create directory: <dir>'. This typically means a filesystem-level failure creating the local cache directory.","triggerScenarios":"Constructing new CustomDataStoreFactory(dataDirectory) where the directory does not exist and mkdirs() fails — parent directory missing with no create permission, read-only filesystem, or a non-directory file already occupying the path.","commonSituations":"Running as a user without write permission on the parent folder; read-only container volumes; a regular file existing where the directory should be; SELinux/AppArmor denials.","solutions":["Check the parent directory's write permissions for the process user and fix with chown/chmod.","Verify no regular file exists at that path; remove or rename it so the directory can be created.","Ensure the filesystem/volume is writable (not mounted read-only).","Create the directory manually beforehand with correct ownership."],"exampleFix":"// before\nnew CustomDataStoreFactory(new File(\"/readonly/mnt/drive-cache\")); // mkdirs fails\n// after\nnew CustomDataStoreFactory(new File(\"/var/lib/app/drive-cache\")); // writable path","handlingStrategy":"validation","validationCode":"File dir = new File(path);\nif (!dir.isDirectory()) {\n  boolean created = dir.mkdirs();\n  if (!created) {\n    throw new IllegalStateException(\"cannot create data dir (permissions? read-only fs?): \" + path);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  new CustomDataStoreFactory(dataDirectory);\n} catch (IOException e) {\n  if (e.getMessage().startsWith(\"unable to create directory\")) {\n    // fix permissions / writable path, then retry once\n  } else { throw e; }\n}","preventionTips":["Pre-create the data directory with correct ownership in deployment scripts.","Check parent directory write permissions for the service user.","Ensure volumes are mounted read-write; verify no file occupies the directory path."],"tags":["google-drive","vfs","mkdir","permissions","io"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}