Hmbown/CodeWhale · error

Cloud agent produced no branch head to raise.

Error message

Cloud agent produced no branch head to raise.

What it means

Thrown while raising a PR after the patch-extraction harness runs: the dispatcher asked the sandbox for the base branch name and the head SHA of the agent's work, and the response was empty (`base_branch` empty) or the head SHA shorter than 7 characters. Without a resolvable head commit there is nothing to push or open a PR from, so the operation aborts before any remote call.

Solutions

  1. Check the harness output/logs to see whether the agent actually made commits; if the task legitimately produced no change, treat the job as no-op rather than retrying.
  2. Ensure the agent's commit step succeeds: configure git user.email/user.name in the sandbox setup and commit on a named work branch.
  3. Verify SANDBOX_WORKSPACE is the directory the agent actually wrote to; a cwd mismatch leaves the extraction repo empty.
  4. Retry the job if the sandbox state was flaky (e.g. the clone only partially completed).

Example fix

// sandbox setup harness: ensure identity and a work branch before the agent runs
["bash", "-lc", "git config user.email agent@example.com && git config user.name agent && git checkout -b work"],
Defensive patterns

Strategy: validation

Validate before calling

// before raising a PR, confirm the sandbox workspace actually has a distinct head
let head = run_harness(&receipt, &HarnessCommand {
    argv: vec!["bash", "-lc", "git rev-parse HEAD 2>/dev/null || true"],
    cwd: SANDBOX_WORKSPACE.into(), timeout_secs: 30,
})?;
if head.trim().len() < 7 { /* agent made no commits — skip PR */ }

Prevention

When it happens

Trigger: Completing a cloud-agent job whose workspace has no commits distinct from the base: the agent made no commits, committed on a detached HEAD the extraction script could not resolve, or `git rev-parse HEAD` returned empty inside a repo with zero commits.

Common situations: Agent finished analysis but never wrote/committed changes; the agent committed but on the wrong branch so the extraction query returned empty; git identity not configured in the sandbox so commits silently failed earlier (surfacing only here); corrupted or non-git workspace path.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/06588df9dc06f5f7. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/cloud_dispatch.rs:1749

                },
            )?
            .trim()
            .to_string();
        let patch = self.run_harness(
            receipt,
            &HarnessCommand {
                argv: vec![
                    "git".to_string(),
                    "format-patch".to_string(),
                    "origin/HEAD..HEAD".to_string(),
                    "--stdout".to_string(),
                ],
                cwd: SANDBOX_WORKSPACE.to_string(),
                timeout_secs: 60,
            },
        )?;
        if base_branch.is_empty() || head_sha.len() < 7 {
            bail!("Cloud agent produced no branch head to raise.");
        }
        if patch.trim().is_empty() {
            bail!("Cloud agent produced an empty patch; refusing to open a PR.");
        }
        Ok(PatchReceipt {
            base_branch,
            head_sha,
            summary,
            patch,
        })
    }

    fn teardown(&self, receipt: &SandboxReceipt) -> Result<()> {
        let api_key = Self::api_key()?;
        if !valid_sandbox_id(&receipt.sandbox_id) {
            bail!("the sandbox id is not a usable path token");
        }
        let url = Self::control_plane_url(&format!("sandbox/{}", receipt.sandbox_id))?;

View on GitHub (pinned to 73e0f67d83)