lapce/lapce · error
Error while creating commit's signature: {}
Error message
Error while creating commit's signature: {} What it means
The catch-all arm of the same signature match in lapce-proxy/src/dispatch.rs:1437: libgit2 failed to create the commit signature with an error code other than NotFound, and libgit2's own message is interpolated. Typical codes are malformed config values (user.name containing '<'/newlines, invalid user.email), config files that fail to parse, or I/O errors reading .git/config.
Source
Thrown at lapce-proxy/src/dispatch.rs:1437
.and_then(|head| Ok(vec![head.peel_to_commit()?]))
.unwrap_or(vec![]);
let parents_refs = parents.iter().collect::<Vec<_>>();
repo.commit(
Some("HEAD"),
&signature,
&signature,
message,
&tree,
&parents_refs,
)?;
Ok(())
}
Err(e) => match e.code() {
NotFound => Err(anyhow!(
"No user.name and/or user.email configured for this git repository."
)),
_ => Err(anyhow!(
"Error while creating commit's signature: {}",
e.message()
)),
},
}
}
fn git_checkout(workspace_path: &Path, reference: &str) -> Result<()> {
let repo = Repository::discover(workspace_path)?;
let (object, reference) = repo.revparse_ext(reference)?;
repo.checkout_tree(&object, None)?;
repo.set_head(reference.unwrap().name().unwrap())?;
Ok(())
}
fn git_discard_files_changes<'a>(
workspace_path: &Path,
files: impl Iterator<Item = &'a Path>,View on GitHub (pinned to c9e4c33948)
Solutions
- Read the embedded libgit2 message — it names the exact config defect
- Reproduce in a terminal: git commit --allow-empty to get git's own diagnosis
- git config --global --edit and fix/flatten user.name and user.email to plain values
- Remove stale .git/config.lock (and ~/.gitconfig.lock) if present
- git config --list --show-origin to find which file carries the bad value
Example fix
# before # user.name accidentally contains the email too git config --global user.name 'Ada <ada@example.com>' # after git config --global user.name 'Ada Lovelace' git config --global user.email 'ada@example.com'
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate config shape before committing: names must be plain, email must contain '@'
let name = repo.config()?.get_string("user.name")?;
let email = repo.config()?.get_string("user.email")?;
if name.contains('<') || !email.contains('@') {
return Err(anyhow!("malformed git identity: user.name='{name}', user.email='{email}'"));
} Try / catch
match git_commit(workspace_path, message, staged) {
Err(e) if e.to_string().contains("commit's signature") => {
// embed libgit2's message; suggest terminal reproduction
Err(e.context("run `git commit` in a terminal to see git's own diagnosis"))
}
other => other,
}? Prevention
- Never paste 'Name <email>' into user.name — keep the two config values separate
- git config --list --show-origin after hand-editing config files
- Delete stale .git/config.lock after crashed git processes
When it happens
Trigger: git2's signature lookup returns e.g. a parse/invalid-spec error: user.name set to 'Name <email>' (double-wrapping), user.email missing '@', .git/config with syntax errors or a stale .git/config.lock, or permission problems reading system config.
Common situations: Users pasting a full 'Name <email>' string into user.name; hand-edited config files with typos; crashed git processes leaving config.lock behind; shared machines with unreadable /etc/gitconfig.
Related errors
- No user.name and/or user.email configured for this git repos
- uri not supported
- get release info failed {}
- no directory
- arch not supported
AI-assisted analysis of lapce/lapce@c9e4c33948 (2026-08-16).
Data as JSON: /api/errors/902e1d52b94d83fc.
Report an issue: GitHub.