Script task fails with command not found

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.


Bamboo provides the ability to execute arbitrary commands and executables on remote or local agents. This is achieved by creating a ScriptTask and specifying the commands to be executed. The commands will then be executed within either the agent context or a specified Docker image.

If the agent is unable to find one of the referenced commands the ScriptTask will fail with command not found . The following is a sample where mycmd  was specified but not found by the agent.

simple	09-Aug-2021 16:45:40	Starting task 'Script' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'
command	09-Aug-2021 16:45:40	Beginning to execute external process for build 'test - test - Default Job #138 (TEST-TEST-JOB1-138)'\n ... running command line: \n/bamboo-home/atlassian-bamboo-7.0.4/temp/\n ... in: /bamboo-home/atlassian-bamboo-7.0.4/xml-data/build-dir/TEST-TEST-JOB1\n ... using extra environment variables: \n..\nbamboo_shortJobKey=JOB1..bamboo_working_directory=/bamboo-home/atlassian-bamboo-7.0.4/xml-data/build-dir/TEST-TEST-JOB1\nbamboo_buildPlanName=test - test - Default Job\n
error	09-Aug-2021 16:45:40	/bamboo-home/atlassian-bamboo-7.0.4/temp/ line 1: mycmd: command not found
simple	09-Aug-2021 16:45:40	Failing task since return code of [/bamboo-home/atlassian-bamboo-7.0.4/temp/] was 127 while expected 0
simple	09-Aug-2021 16:45:41	Finished task 'Script' with result: Failed


A command would show as command not found  if the shell that is trying to execute the command is unable to locate the file. The shell would normally look for commands within the directories listed in the PATH environment variable. Hence if the directory list specified by PATH does not contain the directory where the command is located the shell will fail to find it.

  • A local agent context will inherit the PATH  specified when Bamboo was started.
  • A remote agent context will inherit the PATH  specified when the remote agent was started.
  • If the job specified that it should be executed in a docker context; the PATH would be the default PATH for the specified docker image.


The resolution for the issue is to ensure that the command/executable is accessible by the Bamboo agent

  • The command exists on the system or within the docker  image being used.
  • The directory containing the command is included within the PATH environment variable used. 
  • The command file is executable and has access permissions granting access to the user running the Bamboo agent.

Last modified on Sep 20, 2021

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.