[Solved] java.io.IOException: remote file operation failed - Jenkins Error


Problem: Jenkins job fails with remote file operation failed error. This error was caused while running shell block in the Jenkinsfile groovy script.


If this error occurs, the following are the remediation steps that you could use.

Restart the slave agent

  1. Login to the slave box and stop the slave service.

     ps -ef | grep slave.jar

    get the process id of the slave and kill it.

      kill -9 <process-id>
  2. launch the agent again from the master.

90% of the time, restarting the agent should solve this issue.

File Permissions

Make sure you have enough access writes to the location you are trying to manipulate a file.

Java versions

Make use you are using the right java versions required by the job.