pentaho/pentaho-kettle · error · KettleException

ResourceUtil.Exception.ErrorClosingZipStream

ResourceUtil.Exception.ErrorClosingZipStream

Error message

ResourceUtil.Exception.ErrorClosingZipStream

What it means

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.

Solutions

  1. Check free disk space on the target volume and retry the export
  2. Ensure no other process locks/deletes the zip file during export
  3. Inspect whether the produced zip is complete/corrupt; delete partial output and re-export
  4. Note the close-failure may mask the return value; treat the export as failed and redo it
Defensive patterns

Strategy: try-catch

Validate before calling

if (new File(zipFilename).getUsableSpace() < minRequiredBytes) {
  throw new IllegalStateException("Insufficient disk space for export");
}

Try / catch

try {
  return ResourceUtil.serializeResourceExportInterface(zipFilename, exportable, transMeta);
} catch (KettleException e) {
  // may be a zip-close failure; validate output file before trusting it
  if (!isCompleteZip(zipFilename)) { deleteQuietly(zipFilename); }
  throw e;
}

Prevention

When it happens

Trigger: ZipOutputStream.close() throwing IOException — typically disk full while the final zip central directory is flushed, or the underlying file/channel already broken.

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/resource/ResourceUtil.java:154

          out.putNextEntry( zipEntry );

          out.write( resourceDefinition.getContent().getBytes() );
          out.closeEntry();
        }
        String zipURL = fileObject.getName().toString();
        return new TopLevelResource( topLevelResource, zipURL, "zip:" + zipURL + "!" + topLevelResource );
      } else {
        throw new KettleException( BaseMessages.getString( PKG, "ResourceUtil.Exception.NoResourcesFoundToExport" ) );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "ResourceUtil.Exception.ErrorSerializingExportInterface", resourceExportInterface.toString() ), e );
    } finally {
      if ( out != null ) {
        try {
          out.close();
        } catch ( IOException e ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "ResourceUtil.Exception.ErrorClosingZipStream", zipFilename ) );
        }
      }
    }
  }

  public static String getExplanation( String zipFilename, String launchFile,
    ResourceExportInterface resourceExportInterface ) {

    String commandString = "";
    if ( Const.isWindows() ) {
      if ( resourceExportInterface instanceof TransMeta ) {
        commandString += "Pan.bat /file:\"";
      } else {
        commandString += "Kitchen.bat /file:\"";
      }
    } else {
      if ( resourceExportInterface instanceof TransMeta ) {

View on GitHub (pinned to f3058517a1)