{"record":{"id":"157626f069a80fed","repo":"pentaho/pentaho-kettle","slug":"unable-to-convert-stored-depth-to-depth-at-position","errorCode":null,"errorMessage":"Unable to convert stored depth '...' to depth at position ...","messagePattern":"Unable to convert stored depth '\\.\\.\\.' to depth at position \\.\\.\\.","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java","lineNumber":709,"sourceCode":"      try {\n        Files.delete( tempFile.toPath() );\n      } catch ( IOException e ) {\n        logError( \"Could not delete temporary ZIP file '\" + tempFile + \"'\", e );\n      }\n    }\n  }\n\n  private int determineDepth( String depthString ) throws KettleException {\n    DecimalFormat df = new DecimalFormat( \"0\" );\n    ParsePosition pp = new ParsePosition( 0 );\n    df.setParseIntegerOnly( true );\n    try {\n      Number n = df.parse( depthString, pp );\n      if ( n == null ) {\n        return 1; // default\n      }\n      if ( pp.getErrorIndex() == 0 ) {\n        throw new KettleException( \"Unable to convert stored depth '\"\n          + depthString + \"' to depth at position \" + pp.getErrorIndex() );\n      }\n      return n.intValue();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to convert stored depth '\" + depthString + \"' to depth\", e );\n    }\n  }\n\n  /**\n   * Get the requested part of the filename\n   *\n   * @param filename\n   *          the filename (full) (/path/to/a/file.txt)\n   * @param depth\n   *          the depth to get. 0 means: the complete filename, 1: the name only (file.txt), 2: one folder (a/file.txt)\n   *          3: two folders (to/a/file.txt) and so on.\n   * @return the requested part of the file name up to a certain depth\n   * @throws KettleFileException","sourceCodeStart":691,"sourceCodeEnd":727,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/zipfile/JobEntryZipFile.java#L691-L727","documentation":"JobEntryZipFile.determineDepth() throws this KettleException when the stored source-path depth string parses only partially: ParsePosition.getErrorIndex()==0 means no usable number could be consumed at the start. The message includes the offending string and error position.","triggerScenarios":"Calling depth() on a JobEntryZipFile whose 'stored_source_path_depth' value is non-numeric or starts with characters ParsePosition cannot parse (e.g. 'abc', empty handled separately by default, but '-x' or '\\u0000' hitting errorIndex 0).","commonSituations":"Job file edited by hand with a bad depth value; older PDI versions that did not persist depth producing garbage; string attributes saved where a number was expected.","solutions":["Open the .kjb / repository attributes and correct 'stored_source_path_depth' to a valid non-negative integer (e.g. 1, 2, 3)","Re-open and re-save the zip job entry in Spoon to rewrite the stored depth","If the value is intentionally absent, remove the tag so the code falls back to the default depth of 1"],"exampleFix":"// before\n<stored_source_path_depth>abc</stored_source_path_depth>\n// after\n<stored_source_path_depth>2</stored_source_path_depth>","handlingStrategy":"validation","validationCode":"// validate depth before calling depth()\nString d = jobEntry.getStoredSourcePathDepth();\nif ( d != null && !d.matches( \"\\\\d+\" ) ) {\n  throw new IllegalArgumentException( \"stored_source_path_depth must be a non-negative integer, got: \" + d );\n}","typeGuard":"boolean isValidDepth( String s ) {\n  return s != null && s.matches( \"\\\\d+\" );\n}","tryCatchPattern":"try {\n  int depth = jobEntry.depth();\n} catch ( KettleException e ) {\n  logError( \"Bad stored depth, using default 1: \" + e.getMessage() );\n  int depth = 1; // fallback\n}","preventionTips":["Always persist depth as a plain integer string","Avoid editing depth values by hand in .kjb files","Re-save entries in Spoon after upgrading PDI versions"],"tags":["parsing","pdi","zip","invalid-value"],"backgroundTag":"invalid-argument-format","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"}