gitbutlerapp/gitbutler · error
Aborting due to empty PR title
Error message
Aborting due to empty PR title
What it means
When creating/updating reviews without an explicit message, `but review` opens your editor with a template whose FIRST LINE becomes the PR title (HTML comment lines are stripped first). `parse_review_message` takes that first line, trims it, and bails when it is empty — forges require a title, so the operation aborts before anything is created.
Source
Thrown at crates/but/src/command/legacy/forge/review.rs:889
|| (!is_selected_branch && selected_branch_message.is_some()),
message: is_selected_branch
.then_some(selected_branch_message)
.flatten(),
}
}
#[derive(Clone, Debug)]
pub struct ForgeReviewMessage {
pub title: String,
pub body: String,
}
pub fn parse_review_message(content: &str) -> anyhow::Result<ForgeReviewMessage> {
let mut lines = content.lines();
let title = lines.next().unwrap_or("").trim().to_string();
if title.is_empty() {
anyhow::bail!("Aborting due to empty PR title");
}
// Skip any leading blank lines after the title, then collect the rest as description
let body = lines
.skip_while(|l| l.trim().is_empty())
.collect::<Vec<_>>()
.join("\n")
.trim()
.to_string();
Ok(ForgeReviewMessage { title, body })
}
#[expect(clippy::too_many_arguments)]
async fn publish_review_for_branch(
ctx: &mut Context,
stack_id: Option<StackId>,
branch_name: &str,View on GitHub (pinned to caf1f223d3)
Solutions
- Re-run and make the first line of the buffer a non-empty title; blank lines and comments after it are fine.
- If the editor opened empty or closed instantly, fix `$EDITOR` / `$GIT_EDITOR`.
- Skip the editor entirely: pass `-m/--message "Title"` (multi-line supported) or `-t/--default` to derive title and body from the commit message.
Example fix
# before EDITOR=true but review create # editor writes nothing -> Aborting due to empty PR title # after but review create -m 'Add retry to sync client' but review create -t # title/body from the commit message, no editor
Defensive patterns
Strategy: validation
Validate before calling
# Non-interactive: always pass the title explicitly instead of relying on an editor but review create -m 'Fix pagination in sync client' but review create -t # or derive title/body from the commit message
Type guard
fn has_title(content: &str) -> bool {
content.lines().next().map(|l| !l.trim().is_empty()).unwrap_or(false)
} Prevention
- Keep a non-empty first line in the review editor buffer; comment lines are stripped before parsing.
- Set a real `$EDITOR`/`$GIT_EDITOR` in scripts, or pass `-m/--message` / `-t/--default`.
When it happens
Trigger: Saving the editor buffer with an empty or blank first line (title deleted or left empty); a misconfigured `$EDITOR`/`$GIT_EDITOR` that writes nothing or exits instantly (e.g. `true`); automation running where no real editor can open; putting the title below a leading blank line.
Common situations: Editor template left untouched except comments (the template itself warns 'Leaving it empty ABORTS the operation'); `EDITOR=true` in scripts/CI; editor failures in terminal multiplexers or over broken ssh sessions.
Related errors
- No branch found for ID: {branch_id}
- Failed to parse diff header
- The updated review was missing from the response.
- Invalid source: expected an uncommitted file or branch
- No diffs to show.
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/7c4f480491cfea8a.
Report an issue: GitHub.