{"record":{"id":"88f5b3fbe043344c","repo":"pentaho/pentaho-kettle","slug":"resourceutil-exception-errorclosingzipstream","errorCode":"ResourceUtil.Exception.ErrorClosingZipStream","errorMessage":"ResourceUtil.Exception.ErrorClosingZipStream","messagePattern":"ResourceUtil\\.Exception\\.ErrorClosingZipStream","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/resource/ResourceUtil.java","lineNumber":154,"sourceCode":"          out.putNextEntry( zipEntry );\n\n          out.write( resourceDefinition.getContent().getBytes() );\n          out.closeEntry();\n        }\n        String zipURL = fileObject.getName().toString();\n        return new TopLevelResource( topLevelResource, zipURL, \"zip:\" + zipURL + \"!\" + topLevelResource );\n      } else {\n        throw new KettleException( BaseMessages.getString( PKG, \"ResourceUtil.Exception.NoResourcesFoundToExport\" ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"ResourceUtil.Exception.ErrorSerializingExportInterface\", resourceExportInterface.toString() ), e );\n    } finally {\n      if ( out != null ) {\n        try {\n          out.close();\n        } catch ( IOException e ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"ResourceUtil.Exception.ErrorClosingZipStream\", zipFilename ) );\n        }\n      }\n    }\n  }\n\n  public static String getExplanation( String zipFilename, String launchFile,\n    ResourceExportInterface resourceExportInterface ) {\n\n    String commandString = \"\";\n    if ( Const.isWindows() ) {\n      if ( resourceExportInterface instanceof TransMeta ) {\n        commandString += \"Pan.bat /file:\\\"\";\n      } else {\n        commandString += \"Kitchen.bat /file:\\\"\";\n      }\n    } else {\n      if ( resourceExportInterface instanceof TransMeta ) {","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/resource/ResourceUtil.java#L136-L172","documentation":"Thrown from the finally block of serializeResourceExportInterface when closing the ZipOutputStream fails with an IOException. The message is keyed ResourceUtil.Exception.ErrorClosingZipStream and includes the zip filename. It can mask an earlier successful return or a prior exception from the same method.","triggerScenarios":"ZipOutputStream.close() throwing IOException — typically disk full while the final zip central directory is flushed, or the underlying file/channel already broken.","commonSituations":"Disk quota exceeded on the export volume; file handle issues on network shares; the zip file deleted or locked by another process while export was in progress.","solutions":["Check free disk space on the target volume and retry the export","Ensure no other process locks/deletes the zip file during export","Inspect whether the produced zip is complete/corrupt; delete partial output and re-export","Note the close-failure may mask the return value; treat the export as failed and redo it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (new File(zipFilename).getUsableSpace() < minRequiredBytes) {\n  throw new IllegalStateException(\"Insufficient disk space for export\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return ResourceUtil.serializeResourceExportInterface(zipFilename, exportable, transMeta);\n} catch (KettleException e) {\n  // may be a zip-close failure; validate output file before trusting it\n  if (!isCompleteZip(zipFilename)) { deleteQuietly(zipFilename); }\n  throw e;\n}","preventionTips":["Monitor free disk space on the export volume","Avoid writing exports to network shares prone to handle loss","Delete partial/corrupt zips after failure and re-export","Never assume success if any KettleException escapes the method"],"tags":["zip","io","stream-close","export"],"backgroundTag":"file-write-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"}