{"record":{"id":"96074ad5e4292a22","repo":"pentaho/pentaho-kettle","slug":"registerpackageservlet-exception-copyrequest","errorCode":"RegisterPackageServlet.Exception.CopyRequest","errorMessage":"RegisterPackageServlet.Exception.CopyRequest","messagePattern":"RegisterPackageServlet\\.Exception\\.CopyRequest","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/www/RegisterPackageServlet.java","lineNumber":241,"sourceCode":"   * @param folderName\n   * @return unique temporary directory path.\n   */\n  protected String createTempDirString( String baseDirectory, String folderName ) {\n    return concat( baseDirectory, folderName );\n  }\n\n  /**\n   * Copy file specified in <code>request</code> to <code>directory</code>.\n   * @param request http request with payload.\n   * @param directory local destination directory.\n   * @return copied file path.\n   * @throws KettleException\n   */\n  protected String copyRequestToDirectory( HttpServletRequest request, String directory ) throws KettleException {\n    try {\n      return copyRequestToDirectory( request.getInputStream(), directory );\n    } catch ( IOException ioe ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"RegisterPackageServlet.Exception.CopyRequest\",  directory ), ioe );\n    }\n  }\n\n  /**\n   * Copy contents of <code>inputStream</code> to <code>directory</code>. Expecting zip file.\n   * @param inputStream zip file input stream.\n   * @param directory local destination directory.\n   * @return copied file path.\n   * @throws KettleException\n   */\n  protected String copyRequestToDirectory( InputStream inputStream, String directory ) throws KettleException {\n    String copiedFilePath;\n    try {\n      FileObject foDirectory = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( directory );\n      if ( !foDirectory.exists() ) {\n        foDirectory.createFolder();\n      }\n      FileObject tempZipFile = KettleVFS.getInstance( DefaultBowl.getInstance() )","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/www/RegisterPackageServlet.java#L223-L259","documentation":"RegisterPackageServlet.copyRequestToDirectory wraps an IOException from reading the servlet request input stream into a KettleException with this message (parameterized with the target directory). It means the uploaded package zip could not be read from the request body.","triggerScenarios":"POST /kettle/registerPackage/ where request.getInputStream() throws IOException — client aborted upload, connection reset mid-transfer, or request body already consumed.","commonSituations":"Network interruption during large package upload; client timeouts on slow links; proxy/webserver terminating the connection before the body completes.","solutions":["Check the wrapped IOException cause (connection reset vs. stream closed) in the Carte log.","Retry the registerPackage upload; ensure the client sends the full body before reading the response.","Increase client and proxy timeouts for large uploads.","Verify the client actually streams the zip as the request body (not multipart mismatch) and keeps the connection open."],"exampleFix":"// before\npost(\"/kettle/registerPackage/?dir=/home/admin\", zipBytes); // no timeout headroom\n// after\npost(\"/kettle/registerPackage/?dir=/home/admin\", zipBytes, connectTimeout(30s), writeTimeout(300s));","handlingStrategy":"retry","validationCode":"// client: confirm the full body will be sent and connection is keep-alive\nRequest req = new Request.Builder().url(registerPackageUrl)\n  .post(RequestBody.create(zipBytes, \"application/zip\")).build();\nboolean bodyComplete = zipBytes.length == expectedSize; // verify pre-upload","typeGuard":null,"tryCatchPattern":"try {\n  Response r = client.newCall(req).execute();\n} catch (IOException e) {\n  log.warn(\"upload stream broken, retrying\", e);\n  retryWithBackoff(() -> client.newCall(req).execute(), 3);\n}","preventionTips":["Set generous client timeouts for large uploads.","Ensure proxies allow long-lived request bodies without idle resets.","Verify zip size/checksum client-side before upload.","Retry idempotent uploads on connection resets."],"tags":["io","upload","servlet","zip"],"backgroundTag":"broken-pipe","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"}