pentaho/pentaho-kettle · error · KettleException

Unable to convert stored depth '...' to depth

Error message

Unable to convert stored depth '...' to depth

What it means

JobEntryZipFile.determineDepth() throws this KettleException in its catch-all when parsing the stored depth string throws for any reason (null input, unparsable format). The message includes the raw depth string and the parse exception is the cause.

Solutions

  1. Set 'stored_source_path_depth' to a plain integer string (e.g. "3") in the job XML or repository attributes
  2. Re-save the job entry in Spoon so a valid depth is persisted
  3. Check the cause exception; if null, provide the depth explicitly in the job configuration

Example fix

// before
jobEntry.setStoredSourcePathDepth( null );
// after
jobEntry.setStoredSourcePathDepth( "2" ); // plain integer, locale-safe
Defensive patterns

Strategy: validation

Validate before calling

// validate depth string before use
String d = jobEntry.getStoredSourcePathDepth();
if ( d == null || !d.matches( "\\d+" ) ) {
  jobEntry.setStoredSourcePathDepth( "1" ); // safe default
}

Type guard

boolean hasValidDepth( JobEntryZipFile je ) {
  String s = je.getStoredSourcePathDepth();
  return s != null && s.matches( "\\d+" );
}

Try / catch

try {
  int depth = jobEntry.depth();
} catch ( KettleException e ) {
  logError( "Depth parse failed ('" + e.getMessage() + "'), defaulting to 1" );
  int depth = 1;
}

Prevention

When it happens

Trigger: Calling depth() with a 'stored_source_path_depth' value that is null or cannot be parsed by DecimalFormat with the given ParsePosition, throwing inside the try block.

Common situations: Null depth from a repository that never saved the attribute; locale-sensitive number formats saved on one machine and parsed on another; corrupted job files.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java:714

    }
  }

  private int determineDepth( String depthString ) throws KettleException {
    DecimalFormat df = new DecimalFormat( "0" );
    ParsePosition pp = new ParsePosition( 0 );
    df.setParseIntegerOnly( true );
    try {
      Number n = df.parse( depthString, pp );
      if ( n == null ) {
        return 1; // default
      }
      if ( pp.getErrorIndex() == 0 ) {
        throw new KettleException( "Unable to convert stored depth '"
          + depthString + "' to depth at position " + pp.getErrorIndex() );
      }
      return n.intValue();
    } catch ( Exception e ) {
      throw new KettleException( "Unable to convert stored depth '" + depthString + "' to depth", e );
    }
  }

  /**
   * Get the requested part of the filename
   *
   * @param filename
   *          the filename (full) (/path/to/a/file.txt)
   * @param depth
   *          the depth to get. 0 means: the complete filename, 1: the name only (file.txt), 2: one folder (a/file.txt)
   *          3: two folders (to/a/file.txt) and so on.
   * @return the requested part of the file name up to a certain depth
   * @throws KettleFileException
   */
  private String determineZipfilenameForDepth( String filename, int depth ) throws KettleException {
    try {
      if ( Utils.isEmpty( filename ) ) {
        return null;

View on GitHub (pinned to f3058517a1)