pentaho/pentaho-kettle · error · KettleException

GPG.ErrorWritingTempFile

Error message

GPG.ErrorWritingTempFile

What it means

KettleException with key GPG.ErrorWritingTempFile is thrown by GPG.createTempFile when writing or flushing the passphrase content to the temporary FileWriter fails. The temp file is deleted before rethrowing, so the GPG operation aborts cleanly, but the underlying IOException is preserved as the cause.

Solutions

  1. Check free space on the temp filesystem (df -h) and increase it or move java.io.tmpdir.
  2. Disable aggressive /tmp cleaners (e.g. systemd-tmpfiles) or use a private temp directory.
  3. Retry the operation — transient ENOSPC conditions may resolve after cleanup.
  4. Log e.getCause() to confirm the specific IOException before changing infrastructure.
Defensive patterns

Strategy: retry

Validate before calling

java.io.File tmpDir = new java.io.File(System.getProperty("java.io.tmpdir"));
if (tmpDir.getUsableSpace() < 10 * 1024 * 1024) throw new IllegalStateException("Temp filesystem nearly full");

Try / catch

try {
  gpg.decrypt(content, userId, pass, true);
} catch (KettleException ke) {
  if (ke.getMessage().contains("GPG.ErrorWritingTempFile")) {
    // transient ENOSPC or cleaner interference — safe to retry after cleanup
  }
}

Prevention

When it happens

Trigger: Calling signAndEncrypt, sign, or decrypt when the FileWriter write/flush/close on the created GnuPG temp file throws — disk fills between creation and write, or the file is removed by a cleaner mid-write.

Common situations: Disk quota exceeded during write; /tmp janitor processes deleting files concurrently; very large content; filesystem became read-only after mount remount.

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/e38bf44642d4bc0c. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java:569

    try {
      this.tmpFile = File.createTempFile( "GnuPG", null );
      if ( log.isDebug() ) {
        log.logDebug( BaseMessages.getString( PKG, "GPG.TempFileCreated", getTempFileName() ) );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "GPG.ErrorCreatingTempFile" ), e );
    }

    try {
      fw = new FileWriter( this.tmpFile );
      fw.write( content );
      fw.flush();
      fw.close();
    } catch ( Exception e ) {
      // delete our file:
      deleteTempFile();

      throw new KettleException( BaseMessages.getString( PKG, "GPG.ErrorWritingTempFile" ), e );
    }
  }

  /**
   * Delete temporary file.
   *
   * @throws KettleException
   */
  private void deleteTempFile() {
    if ( this.tmpFile != null ) {
      if ( log.isDebug() ) {
        log.logDebug( BaseMessages.getString( PKG, "GPG.DeletingTempFile", getTempFileName() ) );
      }
      this.tmpFile.delete();
    }
  }

  /**

View on GitHub (pinned to f3058517a1)