{"record":{"id":"e38bf44642d4bc0c","repo":"pentaho/pentaho-kettle","slug":"gpg-errorwritingtempfile","errorCode":null,"errorMessage":"GPG.ErrorWritingTempFile","messagePattern":"GPG\\.ErrorWritingTempFile","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java","lineNumber":569,"sourceCode":"    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   *\n   * @throws KettleException\n   */\n  private void deleteTempFile() {\n    if ( this.tmpFile != null ) {\n      if ( log.isDebug() ) {\n        log.logDebug( BaseMessages.getString( PKG, \"GPG.DeletingTempFile\", getTempFileName() ) );\n      }\n      this.tmpFile.delete();\n    }\n  }\n\n  /**","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/pgpencryptfiles/GPG.java#L551-L587","documentation":"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.","triggerScenarios":"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.","commonSituations":"Disk quota exceeded during write; /tmp janitor processes deleting files concurrently; very large content; filesystem became read-only after mount remount.","solutions":["Check free space on the temp filesystem (df -h) and increase it or move java.io.tmpdir.","Disable aggressive /tmp cleaners (e.g. systemd-tmpfiles) or use a private temp directory.","Retry the operation — transient ENOSPC conditions may resolve after cleanup.","Log e.getCause() to confirm the specific IOException before changing infrastructure."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"java.io.File tmpDir = new java.io.File(System.getProperty(\"java.io.tmpdir\"));\nif (tmpDir.getUsableSpace() < 10 * 1024 * 1024) throw new IllegalStateException(\"Temp filesystem nearly full\");","typeGuard":null,"tryCatchPattern":"try {\n  gpg.decrypt(content, userId, pass, true);\n} catch (KettleException ke) {\n  if (ke.getMessage().contains(\"GPG.ErrorWritingTempFile\")) {\n    // transient ENOSPC or cleaner interference — safe to retry after cleanup\n  }\n}","preventionTips":["Keep ample headroom on the temp filesystem","Exclude java.io.tmpdir from aggressive tmp cleaners","Retry once on transient write failures"],"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"}