Bamboo SCP Task failed to upload file - Received unknown response code

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Bamboo SCP Task failed to upload file. The following exception is present in the build log or <bamboo-install>/logs/catalina.out:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Failed to upload file '/opt/bamboo_agent_home/xml-data/build-dir/TEST-PLAN/xxx.war' net.schmizz.sshj.xfer.scp.SCPException: Received unknown response code at net.schmizz.sshj.xfer.scp.SCPEngine.check(SCPEngine.java:92) at net.schmizz.sshj.xfer.scp.SCPUploadClient.startCopy(SCPUploadClient.java:64) at net.schmizz.sshj.xfer.scp.SCPUploadClient.copy(SCPUploadClient.java:45) at net.schmizz.sshj.xfer.scp.SCPFileTransfer.upload(SCPFileTransfer.java:52) at com.atlassian.bamboo.plugins.scp.ScpTask.transferFiles(ScpTask.java:418) at com.atlassian.bamboo.plugins.scp.ScpTask.execute(ScpTask.java:284) at com.atlassian.bamboo.plugins.scp.ScpTask.run(ScpTask.java:127) at com.atlassian.bamboo.plugins.scp.ScpTask.execute(ScpTask.java:105) at com.atlassian.bamboo.task.TaskExecutorImpl$2.call(TaskExecutorImpl.java:278) at com.atlassian.bamboo.task.TaskExecutorImpl$2.call(TaskExecutorImpl.java:274) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:200) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:274) at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:106) at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:75) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:196) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:124) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:115) at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:215) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:114) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:118) at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49) at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31) at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20) at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at java.lang.Thread.run(Thread.java:745) Copy Failed. Some files were not uploaded successfully.

Cause

A login script on the destination host (e.g. .bashrc) that prints to stdout. scp expects to see its protocol data over the stdin/stdout channels

Resolution

  • Remove the statement or

  • Prefix the statement with: [ -n "$PS1" ] &&

    • E.g. [ -n $"PS1" ] && echo "a"

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.