{"record":{"id":"78a6a10c064a495c","repo":"pentaho/pentaho-kettle","slug":"client-error-creating-folder","errorCode":null,"errorMessage":"Client error creating folder","messagePattern":"Client error creating folder","errorType":"exception","errorClass":"RepositoryClientException","httpStatus":null,"severity":"error","filePath":"plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/repo/RepositoryClient.java","lineNumber":166,"sourceCode":"    if ( tree == null || tree.getChildren() == null ) {\n      return new RepositoryFileDto[0];\n    }\n    return tree.getChildren().stream().map( RepositoryFileTreeDto::getFile ).toArray( RepositoryFileDto[]::new );\n  }\n\n  /** Create folder with given path */\n  public void createFolder( String filePath ) throws RepositoryClientException {\n    try {\n      String path = RepositoryPathEncoder.encodeRepositoryPath( filePath );\n      String service = cfg.getCreateFolderSvc( path );\n\n      WebTarget target = client.target( url + service );\n      Response response = target.request( MediaType.TEXT_PLAIN ).put( Entity.text(\" \") );\n      if ( response.getStatus() != 200 ) {\n        throw new RepositoryClientException( String.valueOf( response ) );\n      }\n    } catch ( WebApplicationException | ProcessingException e ) {\n      throw new RepositoryClientException( \"Client error creating folder\", e );\n    }\n  }\n\n  public RepositoryFileTreeDto getRoot() {\n    return fetchChildTree( new String[0] ).orElse( null );\n  }\n\n  /** Download file contents */\n  public InputStream getData( RepositoryFileDto fileDto ) {\n    String urlPath = encodePath( fileDto.getPath() );\n    // TODO: repo endpoint fails for unrecognized file types\n    String endpoint = url + cfg.getDownloadSvc( urlPath );\n    log.debug( \"getData: \" + endpoint );\n    return client.target( endpoint ).request( MediaType.WILDCARD_TYPE ).get( InputStream.class );\n  }\n\n  /** Download file contents with a buffered input stream of the given size */\n  public InputStream getData( RepositoryFileDto fileDto, int bufferSize ) {","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/repo/RepositoryClient.java#L148-L184","documentation":"createFolder() wraps any JAX-RS WebApplicationException or ProcessingException raised while PUTting to the folder-creation service into RepositoryClientException(\"Client error creating folder\"). It means the HTTP client-side call itself failed (connection problem, bad request, server 4xx/5xx surfaced as an exception).","triggerScenarios":"PUT to url+service fails: server unreachable, network timeout, malformed URL, WebApplicationException from a 4xx/5xx response, or ProcessingException from serialization/connection issues.","commonSituations":"DI/Pentaho server down or wrong port; parent folder path does not exist server-side; authentication failure causing 401/403; firewall/proxy blocking the request.","solutions":["Inspect the wrapped cause (getCause()) to distinguish connection vs. HTTP-status failures","Verify the server URL, port, and network reachability (curl the service endpoint)","Ensure the parent folder path exists and the user has create permissions on the server","Check authentication credentials - a 401/403 from the server surfaces here"],"exampleFix":"// before\nclient.createFolder( new String[]{\"a\",\"b\"} ); // parent 'a' missing -> exception\n// after\nRepositoryFileTreeDto root = client.getRoot();\nclient.createFolder( new String[]{\"a\"} );\nif ( client.getFileInfo( new String[]{\"a\"} ).isPresent() ) {\n  client.createFolder( new String[]{\"a\",\"b\"} );\n}","handlingStrategy":"try-catch","validationCode":"// Preflight: server reachable and parent exists\ntry ( Response r = client.target( url + \"/api/\" ).request().get() ) {\n  if ( r.getStatus() != 200 ) throw new IllegalStateException( \"Server unreachable, status \" + r.getStatus() );\n}\nboolean parentExists = client.getFileInfo( parentPath ).isPresent();","typeGuard":"boolean canCreateFolder( RepositoryClient c, String[] path ) {\n  return c.getFileInfo( Arrays.copyOf( path, path.length - 1 ) ).isPresent();\n}","tryCatchPattern":"try {\n  client.createFolder( path );\n} catch ( RepositoryClientException e ) {\n  Throwable cause = e.getCause();\n  log.error( \"Folder creation failed: {} (cause: {})\", e.getMessage(), cause );\n  if ( cause instanceof ProcessingException ) { /* network: check server/URL */ }\n}","preventionTips":["Verify server URL/port and connectivity before operations","Ensure the parent folder path exists before creating subfolders","Check credentials; 401/403 responses surface as this exception","Retry with backoff on ProcessingException (transient network issues)"],"tags":["http","rest","network","folder-create"],"backgroundTag":"api-request-failed","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"}