{"record":{"id":"7d3ad808b086e0ad","repo":"pentaho/pentaho-kettle","slug":"unable-to-delete-database-with-name-name-and-extension","errorCode":null,"errorMessage":"Unable to delete database with name [ + name + ] and extension [ + extension + ]","messagePattern":"Unable to delete database with name \\[ \\+ name \\+ \\] and extension \\[ \\+ extension \\+ \\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java","lineNumber":449,"sourceCode":"\n  @Override\n  public void deleteSlave( ObjectId id_slave ) throws KettleException {\n    // ID and filename are the same\n    deleteFile( calcDirectoryName( null ) + id_slave.getId() );\n  }\n\n  @Override\n  public void deleteDatabaseMeta( String databaseName ) throws KettleException {\n    deleteRootObject( databaseName, EXT_DATABASE );\n  }\n\n  public void deleteRootObject( String name, String extension ) throws KettleException {\n    try {\n      String filename = calcDirectoryName( null ) + name + extension;\n      FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );\n      fileObject.delete();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to delete database with name [\"\n        + name + \"] and extension [\" + extension + \"]\", e );\n    }\n  }\n\n  public void deleteFile( String filename ) throws KettleException {\n    try {\n      FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );\n      fileObject.delete();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to delete file with name [\" + filename + \"]\", e );\n    }\n  }\n\n  @Override\n  public ObjectId getClusterID( String name ) throws KettleException {\n    // The ID is the filename relative to the base directory, including the file extension\n    //\n    return new StringObjectId( calcObjectId( (RepositoryDirectory) null ) + name + EXT_SLAVE_SERVER );","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java#L431-L467","documentation":"deleteRootObject() deletes a repository object file (name + extension) directly under the repository root. If the VFS delete operation fails for any reason, a KettleException naming the object and extension is thrown with the original cause chained.","triggerScenarios":"Calling deleteRootObject(name, extension) (used by deleteDatabaseMeta and similar) when the target file does not exist as a FileObject that can be deleted, the path is wrong, or the file is locked/permission-protected.","commonSituations":"Deleting a database connection from a file repository where the .kdb file was manually moved/renamed; file locked by another process; read-only filesystem or insufficient permissions; stale repository references to removed files.","solutions":["Check the chained cause: 'does not exist' means the file is already gone — refresh repository metadata or ignore.","Verify the file repo root directory setting matches where the object files actually live.","Close other processes holding locks on the file and retry.","Grant the process delete permission on the repository directory."],"exampleFix":"// before: fails when file already removed\nrepo.deleteRootObject(name, extension);\n\n// after: tolerate already-deleted objects\ntry {\n  repo.deleteRootObject(name, extension);\n} catch (KettleException e) {\n  if (!e.getCause().toString().contains(\"does not exist\")) throw e;\n  log.warn(\"Already deleted: \" + name);\n}","handlingStrategy":"try-catch","validationCode":"// confirm the object file exists before deleting\nFile f = new File(repoBaseDir, name + extension);\nboolean exists = f.exists();","typeGuard":null,"tryCatchPattern":"try {\n  repo.deleteRootObject(name, extension);\n} catch (KettleException e) {\n  if (e.getCause() != null && String.valueOf(e.getCause()).contains(\"does not exist\")) {\n    log.warn(\"Already deleted: \" + name); // idempotent-delete tolerated\n  } else { throw e; }\n}","preventionTips":["Check the object file exists before deleting to stay idempotent","Verify repo base directory config matches actual file locations","Close other processes locking repo files","Ensure delete permissions for the running user"],"tags":["kettle","file-repository","file-delete","vfs"],"backgroundTag":"file-not-found","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"}