pentaho/pentaho-kettle · error · KettleException

GPG.ErrorCreatingTempFile

Error message

GPG.ErrorCreatingTempFile

What it means

KettleException with key GPG.ErrorCreatingTempFile is thrown by GPG.createTempFile when File.createTempFile("GnuPG", null) fails. createTempFile writes the passphrase to a temporary file for gpg to consume (called by signAndEncrypt, sign, decrypt); without this file the operation cannot proceed.

Solutions

  1. Free space in the temp directory or point -Djava.io.tmpdir to a writable location.
  2. Ensure the OS user running Kettle has write permission on the temp directory.
  3. Check for stale GnuPG* temp files and clean them up if inode/file limits are hit.
  4. Run Kettle without a restrictive SecurityManager policy blocking temp file creation.

Example fix

// before
java -jar kettle.jar
// after
java -Djava.io.tmpdir=/var/kettle/tmp -jar kettle.jar
Defensive patterns

Strategy: validation

Validate before calling

java.io.File tmpDir = new java.io.File(System.getProperty("java.io.tmpdir"));
if (!tmpDir.canWrite() || tmpDir.getUsableSpace() < 10 * 1024 * 1024) {
  throw new IllegalStateException("Temp dir not writable or too full");
}

Try / catch

try {
  gpg.sign(content, userId, pass, true);
} catch (KettleException ke) {
  if (ke.getMessage().contains("GPG.ErrorCreatingTempFile")) {
    // fix java.io.tmpdir or free disk space, then retry
  }
}

Prevention

When it happens

Trigger: Calling signAndEncrypt, sign, or decrypt when java.io.tmpdir is not writable, the temp disk is full, or the security policy denies temp file creation.

Common situations: Read-only or full /tmp; java.io.tmpdir pointing to a non-existent directory; SecurityManager restrictions; running in a container with a tiny tmpfs.

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

Appendix: source

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

  /**
   * Create a unique temporary file when needed by one of the main methods. The file handle is store in tmpFile object
   * var.
   *
   * @param content
   *          data to write into the file
   * @throws KettleException
   */
  private void createTempFile( String content ) throws KettleException {
    this.tmpFile = null;
    FileWriter fw;

    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.
   *

View on GitHub (pinned to f3058517a1)