pentaho/pentaho-kettle · error · RepositoryClientException

Failed with error-code

Error message

Failed with error-code 

What it means

delete() PUTs the file/folder ID to the delete endpoint and throws RepositoryClientException("Failed with error-code " + status) whenever the response is null or its HTTP status is not 200 OK. The status code is appended so the caller can see what the server returned.

Solutions

  1. Read the appended status code: 401/403 -> re-authenticate or check permissions; 404 -> treat as already deleted; 5xx -> check server logs
  2. Call getFileInfo() first to confirm the file still exists before deleting
  3. Refresh authentication/cookies and retry the delete
  4. Check server-side references/locks on the file that may block deletion

Example fix

// before
client.delete( file ); // may throw on 404
// after
if ( client.getFileInfo( path ).isPresent() ) {
  try {
    client.delete( file );
  } catch ( RepositoryClientException e ) {
    log.warn( "Delete failed: {}", e.getMessage() ); // contains error-code
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the file exists before deleting
boolean exists = client.getFileInfo( path ).isPresent();
if ( exists ) { client.delete( file ); }

Type guard

boolean deletable( RepositoryClient c, RepositoryFileDto f ) {
  return f != null && f.getId() != null && c.getFileInfo( path ).isPresent();
}

Try / catch

try {
  client.delete( file );
} catch ( RepositoryClientException e ) {
  if ( String.valueOf( e.getMessage() ).contains( "404" ) ) {
    log.info( "Already deleted" ); // idempotent handling
  } else if ( String.valueOf( e.getMessage() ).contains( "401" ) ) {
    reauthenticate();
  }
}

Prevention

When it happens

Trigger: Calling delete() when the server returns a non-200 status (401 unauthorized, 403 forbidden, 404 file not found, 500 server error), or when no response object comes back.

Common situations: Deleting a file that another session already removed; user lacking delete permissions; session/cookie expired mid-operation; server-side lock or referencing content preventing deletion.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/8a5248d666407b58. Report an issue: GitHub.

Appendix: source

Thrown at plugins/repo-vfs/repo-vfs-ws/src/main/java/org/pentaho/di/plugins/repovfs/ws/repo/RepositoryClient.java:204

  }

  protected boolean isKettleFile( String fileName ) {
    switch ( FilenameUtils.getExtension( fileName ).toLowerCase() ) {
      case Const.STRING_TRANS_DEFAULT_EXT:
      case Const.STRING_JOB_DEFAULT_EXT:
        return true;
      default:
        return false;
    }
  }

  /** Delete file or folder */
  public void delete( RepositoryFileDto file ) throws RepositoryClientException {
    final WebTarget target = client.target( url + cfg.getDeleteFileOrFolderUrl() );
    Response response = target.request( MediaType.TEXT_PLAIN ).put( Entity.entity( file.getId(), MediaType.TEXT_PLAIN ) );

    if ( response == null || response.getStatus() != Response.Status.OK.getStatusCode() ) {
      throw new RepositoryClientException( "Failed with error-code " + response.getStatus() );
    }
  }

  /** Upload file with given data to the server */
  public void writeData( final String[] fileName, InputStream data ) throws RepositoryClientException {
    final StringBuilder pathBuilder = new StringBuilder();
    for ( int i = 0; i < fileName.length; i++ ) {
      if ( i != 0 ) {
        pathBuilder.append( "/" );
      }
      pathBuilder.append( fileName[ i ] );
    }
    String path = encodePath( pathBuilder.toString() );
    String service = cfg.getUploadSvc( path );

    final WebTarget target = client.target( url + service );
    Response response = target.request( MediaType.TEXT_PLAIN ).put( Entity.entity( data, MediaType.TEXT_PLAIN ) );

View on GitHub (pinned to f3058517a1)