{"record":{"id":"6b428700e6682e6d","repo":"pentaho/pentaho-kettle","slug":"the-given-backend-file-is-not-a-directory","errorCode":null,"errorMessage":"The given backend-file is not a directory.","messagePattern":"The given backend-file is not a directory\\.","errorType":"exception","errorClass":"ContentIOException","httpStatus":null,"severity":"error","filePath":"plugins/pentaho-reporting/impl/src/main/java/org/pentaho/di/trans/steps/pentahoreporting/urlrepository/FileObjectContentLocation.java","lineNumber":54,"sourceCode":"  private static final long serialVersionUID = -5452372293937107734L;\n\n  /**\n   * Creates a new location for the given parent and directory.\n   *\n   * @param parent  the parent location.\n   * @param backend the backend.\n   * @throws ContentIOException if an error occured or the file did not point to a directory.\n   */\n  public FileObjectContentLocation( final ContentLocation parent, final FileObject backend ) throws ContentIOException {\n    super( parent, backend );\n    boolean error;\n    try {\n      error = backend.exists() == false || backend.isFolder() == false;\n    } catch ( FileSystemException e ) {\n      throw new RuntimeException( e );\n    }\n    if ( error ) {\n      throw new ContentIOException( \"The given backend-file is not a directory.\" );\n    }\n  }\n\n  /**\n   * Creates a new root-location for the given repository and directory.\n   *\n   * @param repository the repository for which a location should be created.\n   * @param backend    the backend.\n   * @throws ContentIOException if an error occured or the file did not point to a directory.\n   */\n  public FileObjectContentLocation( final Repository repository, final FileObject backend ) throws ContentIOException {\n    super( repository, backend );\n    boolean error;\n    try {\n      error = backend.exists() == false || backend.isFolder() == false;\n    } catch ( FileSystemException e ) {\n      throw new RuntimeException( e );\n    }","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pentaho-reporting/impl/src/main/java/org/pentaho/di/trans/steps/pentahoreporting/urlrepository/FileObjectContentLocation.java#L36-L72","documentation":"The FileObjectContentLocation constructor validates that the given VFS FileObject backend is an existing folder. If it does not exist or is not a folder, it throws ContentIOException(\"The given backend-file is not a directory.\"); FileSystemException during the check is rethrown as RuntimeException. This guards the URL report repository against being rooted at a file or a missing path.","triggerScenarios":"Constructing a FileObjectContentLocation with a backend that backend.exists()==false or backend.isFolder()==false — e.g. a path pointing at a regular file, or a non-existent directory passed as the repository root.","commonSituations":"Report output URL/repository configured with a file path instead of a directory; directory deleted before the export; typo in the repository root path so the folder never existed; VFS scheme mismatch (file vs. remote provider).","solutions":["Pre-create the directory used as the repository root before running the export","Point the configuration at a directory, not a file path","Fix the path/scheme typo in the URL repository configuration","Wrap the check: if the backend is missing, create it (createFolder) before constructing the content location"],"exampleFix":"// before\nFileObject repo = KettleVFS.getInstance( bowl ).getFileObject( path );\nnew FileObjectContentLocation( null, repo );\n// after\nFileObject repo = KettleVFS.getInstance( bowl ).getFileObject( path );\nif ( !repo.exists() ) {\n  repo.createFolder();\n}\nnew FileObjectContentLocation( null, repo );","handlingStrategy":"validation","validationCode":"FileObject backend = KettleVFS.getInstance( bowl ).getFileObject( repoPath );\nif ( !backend.exists() ) backend.createFolder();\nif ( !backend.isFolder() ) {\n  throw new IllegalArgumentException( repoPath + \" is not a directory\" );\n}","typeGuard":"boolean isValidRepoRoot( FileObject backend ) {\n  try {\n    return backend != null && backend.exists() && backend.isFolder();\n  } catch ( FileSystemException e ) {\n    return false;\n  }\n}","tryCatchPattern":"try {\n  new FileObjectContentLocation( null, backend );\n} catch ( ContentIOException e ) {\n  logError( \"Repository root invalid: \" + backend.getName().getURI(), e );\n}","preventionTips":["Configure the repository root as an existing directory, never a file","Pre-create directories before the reporting export runs","Validate the URL/scheme of the repository root at job start","Watch for external processes deleting the directory mid-run"],"tags":["vfs","reporting","path-config"],"backgroundTag":"path-is-not-a-directory","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"}