{"record":{"id":"88e40ad460216d6b","repo":"pentaho/pentaho-kettle","slug":"gpg-errorcreatingtempfile","errorCode":null,"errorMessage":"GPG.ErrorCreatingTempFile","messagePattern":"GPG\\.ErrorCreatingTempFile","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java","lineNumber":557,"sourceCode":"  /**\n   * Create a unique temporary file when needed by one of the main methods. The file handle is store in tmpFile object\n   * var.\n   *\n   * @param content\n   *          data to write into the file\n   * @throws KettleException\n   */\n  private void createTempFile( String content ) throws KettleException {\n    this.tmpFile = null;\n    FileWriter fw;\n\n    try {\n      this.tmpFile = File.createTempFile( \"GnuPG\", null );\n      if ( log.isDebug() ) {\n        log.logDebug( BaseMessages.getString( PKG, \"GPG.TempFileCreated\", getTempFileName() ) );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"GPG.ErrorCreatingTempFile\" ), e );\n    }\n\n    try {\n      fw = new FileWriter( this.tmpFile );\n      fw.write( content );\n      fw.flush();\n      fw.close();\n    } catch ( Exception e ) {\n      // delete our file:\n      deleteTempFile();\n\n      throw new KettleException( BaseMessages.getString( PKG, \"GPG.ErrorWritingTempFile\" ), e );\n    }\n  }\n\n  /**\n   * Delete temporary file.\n   *","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java#L539-L575","documentation":"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.","triggerScenarios":"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.","commonSituations":"Read-only or full /tmp; java.io.tmpdir pointing to a non-existent directory; SecurityManager restrictions; running in a container with a tiny tmpfs.","solutions":["Free space in the temp directory or point -Djava.io.tmpdir to a writable location.","Ensure the OS user running Kettle has write permission on the temp directory.","Check for stale GnuPG* temp files and clean them up if inode/file limits are hit.","Run Kettle without a restrictive SecurityManager policy blocking temp file creation."],"exampleFix":"// before\njava -jar kettle.jar\n// after\njava -Djava.io.tmpdir=/var/kettle/tmp -jar kettle.jar","handlingStrategy":"validation","validationCode":"java.io.File tmpDir = new java.io.File(System.getProperty(\"java.io.tmpdir\"));\nif (!tmpDir.canWrite() || tmpDir.getUsableSpace() < 10 * 1024 * 1024) {\n  throw new IllegalStateException(\"Temp dir not writable or too full\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  gpg.sign(content, userId, pass, true);\n} catch (KettleException ke) {\n  if (ke.getMessage().contains(\"GPG.ErrorCreatingTempFile\")) {\n    // fix java.io.tmpdir or free disk space, then retry\n  }\n}","preventionTips":["Monitor temp directory free space","Set -Djava.io.tmpdir to a dedicated writable dir","Clean stale GnuPG* temp files periodically"],"tags":["gpg","temp-file","filesystem","io"],"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"}