gitbutlerapp/gitbutler · error
line : unknown command
Error message
line {line_number}: unknown command '{other}' What it means
The integration script DSL only supports three commands: `pick`, `merge`, and `squash`. Any other first token on a non-comment line causes this error, which names the unrecognized command and the line number. This keeps edited scripts from silently dropping steps (a la `git rebase -i`'s `drop`), since silently ignoring unknown commands could lose integration intent.
Solutions
- Replace the unknown command with `pick <hash>` for a single local/upstream commit.
- Use `merge <hash>` for upstream commits to merge, or `squash <hash1> <hash2> [...] | message="..."` to combine commits.
- If you wanted to drop a commit, delete the line entirely — commands absent from the script are simply not applied.
- Fix typos in the command keyword (e.g. `pik` -> `pick`).
Example fix
// before (script text) drop 3333333 // after # line removed to drop the commit
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = new Set(['pick', 'merge', 'squash']);
function validateCommands(script: string): string[] {
return script.split('\n').flatMap((line, i) => {
const t = line.trim();
if (!t || t.startsWith('#')) return [];
const cmd = t.split(/\s+/)[0];
return ALLOWED.has(cmd) ? [] : [`line ${i + 1}: unknown command '${cmd}'`];
});
} Type guard
const isKnownCommand = (line: string): boolean => ['pick', 'merge', 'squash'].includes(line.trim().split(/\s+/)[0]);
Try / catch
try {
const steps = await parseIntegrationScript(script, divergence);
} catch (err) {
const m = /line (\d+): unknown command '(.+)'/.exec(String(err));
if (m) showEditorErrorAtLine(Number(m[1]), `'${m[2]}' is not a valid command; use pick/merge/squash`);
else throw err;
} Prevention
- Only use pick, merge, and squash — rebase-todo commands like drop/reword/fixup are not supported.
- To drop a commit, delete its line; to reword a squash result, use its `| message=` clause.
- Add notes as `#` comment lines so they are never parsed as commands.
When it happens
Trigger: Calling parse_integration_steps_script with a line whose first whitespace-delimited token is not `pick`, `merge`, or `squash` — e.g. `drop 3333333`, `reword ...`, `fixup ...`, or a typo like `pik 3333333`.
Common situations: Users paste lines from `git rebase -i` todo files (`drop`, `reword`, `fixup`, `edit`, `exec`), or mistype a command. Blank lines and lines starting with `#` are ignored, so comments never trigger this.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- line : merge does not accept a message clause
- line : merge requires exactly one commit
- line : pick requires exactly one commit
- line : squash requires at least two commits
- message must start with a double quote
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/c10cace7e859c538.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:101
.map(|commit| {
resolve_commit(commit, &allowed_commits).map_err(|err| {
anyhow::anyhow!(
"line {line_number}: invalid squash commit '{commit}': {err}"
)
})
})
.collect::<Result<Vec<_>>>()?;
InteractiveIntegrationStep::Squash {
commits,
message: message_part
.map(parse_message_clause)
.transpose()
.map_err(|err| {
anyhow::anyhow!("line {line_number}: invalid squash message: {err}")
})?,
}
}
other => bail!("line {line_number}: unknown command '{other}'"),
};
steps.push(step);
}
Ok(steps)
}
fn render_step(step: &InteractiveIntegrationStep) -> String {
match step {
InteractiveIntegrationStep::Pick { commit_id } => format!("pick {}", short_id(*commit_id)),
InteractiveIntegrationStep::Merge { commit_id } => {
format!("merge {}", short_id(*commit_id))
}
InteractiveIntegrationStep::Squash { commits, message } => {
let mut rendered = format!(
"squash {}",
commits
.iter()View on GitHub (pinned to 58e5313667)