gitbutlerapp/gitbutler · error
Aborting due to empty PR title
Error message
Aborting due to empty PR title
What it means
`parse_review_message` parses the editor buffer into a PR title + body. The first non-empty trimmed line is the required title; if the content starts with blank lines only (or the file is empty), the title is empty and parsing aborts with this message — mirroring git's behavior of aborting actions on an empty commit message.
Solutions
- Re-run the command and enter a non-empty first line as the title
- If the message was lost, check the editor's undo history or recovery files (e.g. vim `~/.vim/undo`), or re-run and rewrite it
- Avoid leading blank lines — the title must be on line 1 (leading blanks after the title are fine for the body)
- For automation, always include a title as the first line of the passed content
Example fix
// before "\n\nmy description" // fails: empty title // after "Add feature X\n\nmy description"
Defensive patterns
Strategy: validation
Validate before calling
let title = content.lines().next().unwrap_or("").trim();
if title.is_empty() {
bail!("PR title must be the first line and non-empty");
} Try / catch
match parse_review_message(&buffer) {
Err(e) if e.to_string().contains("empty PR title") => {
eprintln!("Editor content had no title; aborting without creating PR");
}
other => other?,
} Prevention
- Put the title on line 1 of the editor buffer — never leave leading blank lines
- Do not customize the editor template in ways that move the title off the first line
- In automation, programmatically assert the first line is non-empty before invoking the parser
When it happens
Trigger: Saving an empty file or only whitespace/blank lines in the editor invoked by `get_pr_title_and_body_from_editor`; deleting the title line before saving; piping empty content into `parse_review_message` from any of its parser callers.
Common situations: User opens editor, saves without typing a title; editor template customized in a way that leaves the first line blank; scripted use passing empty strings; accidentally `:wq` in vim before typing.
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 gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/7c4f480491cfea8a.
Report an issue: GitHub.
Appendix: 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 58e5313667)