# Bamboo Build Failed: Complete Troubleshooting Guide

Atlassian Bamboo is an integration server that ties together builds, tests, and deployments. When Bamboo builds fail, it can be due to agent problems, task misconfiguration, artifact issues, or deployment complications.

Let me walk through the most common Bamboo build failures and how to fix each one systematically.

Reading Bamboo Build Logs

Understanding the log structure helps locate errors:

  1. 1.Go to your build plan's Build result
  2. 2.Click on the failed build number
  3. 3.Expand the failed job/stage
  4. 4.Click on the failed task for detailed logs

Bamboo logs show: - Build number and duration - Stage execution order - Task-level output - Error summary at the end

Fix 1: No Eligible Agent Available

Builds queue indefinitely waiting for an agent.

Symptoms: - "No eligible agent to run build" - Build stuck in "Pending" state - Queue shows builds waiting

Diagnosis:

  1. 1.Go to Administration → Agents
  2. 2.Check agent status (online/offline)
  3. 3.Check agent capabilities vs build requirements

Solution A: Check agent status:

```bash # On agent machine, check if agent is running ps aux | grep bamboo-agent

# Check agent logs tail -100 /var/log/bamboo-agent.log

# Start agent if stopped cd /opt/bamboo-agent ./bin/bamboo-agent.sh start ```

Solution B: Match requirements to capabilities:

Build requirements may not match agent capabilities:

  1. 1.Edit your build plan
  2. 2.Go to Requirements tab
  3. 3.Check what's required (e.g., ant, java, docker)

On agent machine, ensure capabilities:

```bash # Check agent capabilities cat /opt/bamboo-agent/conf/wrapper.conf | grep bamboo.agent.capability

# Add capabilities manually in Bamboo UI: # Administration → Agents → [Agent] → Capabilities → Add Capability ```

Common capabilities: - system.builder.command.Command: /usr/bin/bash - system.builder.ant.Ant: /opt/ant/bin/ant - custom.docker: true

Solution C: Enable more agents:

  1. 1.Go to Administration → Agents
  2. 2.Enable disabled agents
  3. 3.Authorize new agents

Solution D: Adjust agent assignment:

  1. 1.Edit build plan
  2. 2.Build plan → Stages → Jobs → Agent Assignment
  3. 3.Select specific agent or pool

Fix 2: Task Execution Failures

Build tasks fail with various errors.

Symptoms: - Task shows "Failed" - Non-zero exit code - Specific error message in logs

Solution A: Fix command task errors:

For Script/Command tasks:

bash
Command returned exit code: 1

Check the actual command:

  1. 1.Edit the task
  2. 2.Review the script/command
  3. 3.Test locally:

```bash # Run same command locally cd /path/to/project ./script.sh # Or the exact command

# Check for: # - Missing dependencies # - Wrong paths # - Permission issues ```

Solution B: Fix Maven/Gradle task errors:

bash
[ERROR] Failed to execute goal ...
xml
<!-- Bamboo Maven task configuration -->
<task type="maven">
  <goal>clean package</goal>
  <jdk>JDK 17</jdk>
  <mavenVersion>Maven 3.9</mavenVersion>
</task>

Common fixes: - Check JDK is configured in Bamboo - Verify Maven settings.xml location - Check dependency repositories

Solution C: Fix Docker task errors:

bash
Error: Cannot connect to the Docker daemon

```bash # On agent machine sudo systemctl status docker sudo docker ps

# Fix permissions sudo usermod -aG docker bamboo-agent-user sudo systemctl restart docker ```

Fix 3: Source Code Checkout Failures

Repository clone or update fails.

Symptoms: - "Failed to checkout repository" - "Authentication failed" - "Repository not found"

Solution A: Fix Git authentication:

For SSH keys:

  1. 1.Go to Administration → Shared credentials
  2. 2.Add SSH key credential
  3. 3.Link to build plan repository

Or add per-plan:

  1. 1.Edit build plan → Repository
  2. 2.Change authentication to SSH key
  3. 3.Provide key or select from shared credentials

For HTTPS with password:

  1. 1.Edit repository configuration
  2. 2.Use password authentication
  3. 3.Store credentials in Bamboo

Solution B: Fix repository URL:

```bash # Check repository is accessible git clone https://github.com/org/repo.git /tmp/test-clone

# If failing, verify URL # Edit plan → Repository → Repository URL ```

Solution C: Fix branch configuration:

  1. 1.Edit plan → Repository → Branch
  2. 2.Ensure correct branch is selected
  3. 3.For feature branches, enable "Branch triggering"

Fix 4: Artifact Transfer Failures

Artifacts fail to transfer between stages.

Symptoms: - "Failed to retrieve artifact" - "Artifact not found" - "Artifact directory not accessible"

Solution A: Configure artifact definitions:

  1. 1.Edit build plan
  2. 2.Artifacts → Artifact Definitions
  3. 3.Add artifact:
NameLocationCopy Pattern
build-outputtarget/*.jar

Solution B: Configure artifact subscriptions:

In consuming job:

  1. 1.Edit job → Artifacts → Artifact Subscriptions
  2. 2.Subscribe to artifact from previous stage
  3. 3.Set destination directory

Solution C: Fix artifact paths:

```bash # Check if artifact was actually created ls -la /opt/bamboo-agent/home/xml-data/build-dir/PLAN-KEY-JOB1/

# Common issues: # - Wrong source path # - Pattern doesn't match files # - Destination not writable ```

Fix 5: Test Result Parsing Failures

Tests run but results aren't parsed correctly.

Symptoms: - "No test results found" - Tests pass but Bamboo shows failures - Test parsing errors

Solution A: Configure test collector:

  1. 1.Edit job → Tasks
  2. 2.Add JUnit Test Collector (or relevant collector)
  3. 3.Configure result file pattern:
bash
target/surefire-reports/*.xml

For custom test formats:

  1. 1.Add Custom Test Collector
  2. 2.Set path to results
  3. 3.Configure parsing options

Solution B: Fix test output location:

Ensure tests write to expected location:

xml
<!-- Maven pom.xml -->
<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <reportsDirectory>target/surefire-reports</reportsDirectory>
  </configuration>
</plugin>

Solution C: Check test format:

bash
# Verify test results are valid XML
xmllint target/surefire-reports/TEST-*.xml

Fix 6: Environment Variable Issues

Variables not available in tasks.

Symptoms: - $bamboo_VARIABLE empty - Script uses wrong variable syntax - Environment not set

Solution A: Use correct Bamboo variables:

```bash # Bamboo built-in variables echo $bamboo_buildNumber echo $bamboo_planKey echo $bamboo_repository_branch_name

# Custom variables (plan level) # Edit plan → Variables → Add variable

# Use in scripts echo "Build ${bamboo.buildNumber}" ```

Solution B: Set task-level variables:

  1. 1.Edit task → Environment Variables
  2. 2.Add variables:
bash
APP_ENV=test
BUILD_DIR=${bamboo.buildWorkingDirectory}

Solution C: Pass variables to scripts:

bash
# In task script
export JAVA_HOME=/usr/lib/jvm/java-17
export PATH=$JAVA_HOME/bin:$PATH
./build.sh

Fix 7: Deployment Project Failments

Deployments to environments fail.

Symptoms: - "Deployment failed" - Permission denied on target - Deployment task errors

Solution A: Fix deployment permissions:

  1. 1.Go to Deployment project → Permissions
  2. 2.Ensure user/group has deployment permission
  3. 3.Check environment permissions

Solution B: Fix SSH deployment:

For SSH tasks:

bash
SSH task failed: Permission denied
  1. 1.Deployment project → Credentials
  2. 2.Add SSH credentials
  3. 3.Link to deployment task

Solution C: Fix artifact download:

Deployment needs artifact from build:

  1. 1.Edit deployment → Artifact subscription
  2. 2.Select artifact from build plan
  3. 3.Ensure artifact is shared

Fix 8: Build Timeout

Builds exceed time limits.

Symptoms: - "Build exceeded timeout" - Build terminated during execution

Solution A: Increase build timeout:

  1. 1.Edit plan → Plan configuration
  2. 2.Change "Build hangs if running longer than" (default 5 hours)

Solution B: Optimize build:

```bash # Split long tests mvn test -Dtest=unit.* # Separate from integration tests

# Use parallel execution # Edit plan → Stages → Configure parallel execution ```

Solution C: Add progress output:

bash
# In long-running script
echo "Starting step 1..."
# ... long work
echo "Step 1 complete"
echo "Starting step 2..."

Fix 9: Notification Failures

Build notifications don't send.

Symptoms: - No emails/Slack notifications - Notification errors in logs

Solution A: Configure notifications:

  1. 1.Edit plan → Notifications
  2. 2.Add notification:
  3. 3.- Email
  4. 4.- Slack (requires webhook)
  5. 5.- HipChat/Stride

Solution B: Fix email server:

  1. 1.Administration → Mail server
  2. 2.Configure SMTP server
  3. 3.Test configuration

Solution C: Fix Slack integration:

yaml
# Slack webhook configuration
Webhook URL: https://hooks.slack.com/services/TOKEN
Channel: #builds

In Bamboo:

  1. 1.Administration → Integrations → Slack
  2. 2.Configure webhook

Fix 10: Agent Disk Space Issues

Agent runs out of disk space.

Symptoms: - "No space left on device" - Builds fail mid-execution

Solution A: Check disk:

```bash # On agent machine df -h /opt/bamboo-agent

# Clean old builds find /opt/bamboo-agent/home/xml-data/build-dir -type d -mtime +7 -exec rm -rf {} + ```

Solution B: Configure cleanup:

  1. 1.Administration → Build logs → Cleanup
  2. 2.Configure retention policy
  3. 3.Set cleanup schedule

Solution C: Relocate working directory:

bash
# Edit agent wrapper.conf
wrapper.app.parameter.4=/mnt/large-disk/bamboo-agent-home

Quick Reference: Bamboo Errors

ErrorCauseSolution
No eligible agentAgent offline or incompatibleCheck capabilities, start agent
Checkout failedAuth or URL issueFix repository credentials
Task failedScript/command errorCheck command, dependencies
Artifact not foundWrong path or patternFix artifact definition
No test resultsMissing collectorAdd test collector task
Deployment failedPermission or artifactFix credentials, subscription
Build timeoutBuild too longIncrease timeout, optimize
Disk fullArtifact accumulationClean up, relocate directory

Debugging Commands

```bash # Check agent status /opt/bamboo-agent/bin/bamboo-agent.sh status

# View agent logs tail -100 /var/log/bamboo-agent.log

# Check build working directory ls -la /opt/bamboo-agent/home/xml-data/build-dir/PLAN-JOB/

# Check agent capabilities cat /opt/bamboo-agent/bamboo-agent-home/capabilities.properties

# Check disk space df -h /opt/bamboo-agent

# Test repository access git clone REPO_URL /tmp/test-clone

# Check environment env | sort | grep bamboo ```