{"record":{"id":"806bd9bfa579fa40","repo":"pentaho/pentaho-kettle","slug":"io-exception-while-running-the-process","errorCode":null,"errorMessage":"IO exception while running the process ","messagePattern":"IO exception while running the process ","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java","lineNumber":230,"sourceCode":"      if ( p == null ) {\n        processresult.setErrorStream( errorMsg );\n      } else {\n        // get output stream\n        processresult.setOutputStream( getOutputString( new BufferedReader( new InputStreamReader( p\n          .getInputStream() ) ) ) );\n\n        // get error message\n        processresult.setErrorStream( getOutputString( new BufferedReader( new InputStreamReader( p\n          .getErrorStream() ) ) ) );\n\n        // Wait until end\n        p.waitFor();\n\n        // get exit status\n        processresult.setExistStatus( p.exitValue() );\n      }\n    } catch ( IOException ioe ) {\n      throw new KettleException( \"IO exception while running the process \" + Arrays.toString( process ) + \"!\", ioe );\n    } catch ( InterruptedException ie ) {\n      throw new KettleException( \"Interrupted exception while running the process \" + Arrays.toString( process ) + \"!\", ie );\n    } catch ( Exception e ) {\n      throw new KettleException( e );\n    } finally {\n      if ( p != null ) {\n        p.destroy();\n      }\n    }\n  }\n\n  private String getOutputString( BufferedReader b ) throws IOException {\n    StringBuilder retvalBuff = new StringBuilder();\n    String line;\n    String delim = meta.getOutputLineDelimiter();\n    if ( delim == null ) {\n      delim = \"\";\n    } else {","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java#L212-L248","documentation":"ExecProcess wraps any IOException from launching or waiting on the child process (ProcessBuilder start, waitFor/streams) into a KettleException naming the full command array. Commonly the executable does not exist or is not executable.","triggerScenarios":"execProcess: Runtime.exec/ProcessBuilder.start throws IOException — command not found, permission denied on the executable, working directory invalid, or stream redirect failures.","commonSituations":"Command string contains the binary name only and it is not on PATH; spaces/paths on Windows (cmd /c needed); row-supplied command with bad characters; no execute permission on the script; environment variables missing.","solutions":["Check the cause (IOException message: 'No such file or directory' vs 'Permission denied') and fix the command path.","Use an absolute path to the executable or ensure it is on PATH for the Pentaho user.","For shell built-ins/Windows commands, wrap in ['cmd','/c',cmd] or ['/bin/sh','-c',cmd].","chmod +x the script and verify the Pentaho process user can execute it."],"exampleFix":"// before: relies on PATH, fails with IOException\nString[] process = new String[] { \"myscript.sh\" };\n// after\nString[] process = new String[] { \"/opt/scripts/myscript.sh\" }; // chmod +x applied\n// or for shell commands:\nString[] process = new String[] { \"/bin/sh\", \"-c\", processString };","handlingStrategy":"try-catch","validationCode":"// pre-check the executable\njava.io.File exe = new java.io.File(command[0]);\nif (!exe.canExecute()) { throw new IllegalStateException(\"Not executable: \" + command[0]); }","typeGuard":null,"tryCatchPattern":"try { execProcess(process, args, execResult); } catch (KettleException e) { if (e.getCause() instanceof IOException) { log.error(\"Cannot launch process \" + Arrays.toString(process), e.getCause()); } }","preventionTips":["Use absolute paths for executables","chmod +x scripts and check the runtime user's permissions","Wrap shell built-ins in /bin/sh -c or cmd /c"],"tags":["io","process-execution","command-not-found","permissions"],"backgroundTag":"command-not-found","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"}