block/buzz · error
invalid URL {url:?}: {e}
Error message
invalid URL {url:?}: {e} What it means
git-credential-nostr assembles the NIP-98 HTTP-auth URL as {protocol}://{host}/{repo_path} from the fields git passes on stdin (credential.useHttpPath must be true) and panics if Url::parse rejects the result. The panic crashes the credential helper, and git reports a generic credential-helper failure.
Source
Thrown at crates/git-credential-nostr/src/lib.rs:226
let mut raw_key = match load_key() {
Ok(k) => k,
Err(e) => {
eprintln!("error: {e}");
return 1;
}
};
let keys = match Keys::parse(&raw_key) {
Ok(k) => k,
Err(e) => {
raw_key.zeroize();
eprintln!("error: invalid nostr private key: {e}");
return 1;
}
};
raw_key.zeroize();
let parsed_url = Url::parse(&url).unwrap_or_else(|e| panic!("invalid URL {url:?}: {e}"));
let http_data = HttpData::new(parsed_url, method);
let auth_tag = match load_auth_tag() {
Ok(tag) => tag,
Err(e) => {
eprintln!("error: {e}");
return 1;
}
};
let builder = EventBuilder::http_auth(http_data);
let builder = match auth_tag {
Some(tag) => builder.tag(tag),
None => builder,
};
let event = match builder.sign_with_keys(&keys) {
Ok(e) => e,
Err(e) => {
eprintln!("error: failed to sign NIP-98 event: {e}");
return 1;View on GitHub (pinned to 934f3325c3)
Solutions
- Inspect and fix the remote: git remote -v, then git remote set-url origin with a properly encoded URL
- Reproduce git's stdin with `printf 'protocol=...\nhost=...\npath=...\n' | git-credential-nostr get` to see the exact URL that fails to parse
- Ensure credential.useHttpPath=true is configured so the path arrives intact rather than mangled
- Upgrade the helper to a build that reports the invalid URL on stderr and exits 1 instead of panicking
Example fix
// crates/git-credential-nostr/src/lib.rs
// before
let parsed_url = Url::parse(&url).unwrap_or_else(|e| panic!("invalid URL {url:?}: {e}"));
// after
let parsed_url = match Url::parse(&url) {
Ok(u) => u,
Err(e) => {
eprintln!("error: invalid URL {url:?}: {e}");
return 1;
}
}; Defensive patterns
Strategy: validation
Validate before calling
// Validate the assembled URL the same way the helper does, before invoking git
let candidate = format!("{protocol}://{host}/{repo_path}");
if url::Url::parse(&candidate).is_err() {
eprintln!("remote URL is not parseable: {candidate} — fix the git remote");
return;
} Try / catch
// In the helper itself: never panic in a credential-helper process —
// write the error to stderr and exit non-zero so git reports auth failure
let parsed_url = match Url::parse(&url) {
Ok(u) => u,
Err(e) => { eprintln!("error: invalid URL {url:?}: {e}"); return 1; }
}; Prevention
- Always create Buzz remotes via the documented buzz CLI (repos clone/remote) so URLs are canonical
- Percent-encode repo paths containing spaces or non-ASCII before writing them into git remotes
- Test helper wiring with a known-good remote after any .git/config edit
When it happens
Trigger: git invokes the helper (get/fill) for a Buzz remote whose host or path contains characters forbidden in URLs (spaces, raw %, control characters, unencoded non-ASCII) or whose protocol field is malformed, so the constructed string fails Url::parse at crates/git-credential-nostr/src/lib.rs:226.
Common situations: Hand-edited remote in .git/config, a repo path with spaces copied from a browser, a proxy or wrapper rewriting the remote URL, or a broken [credential] config producing unexpected stdin fields.
Related errors
- BUZZ_RELAY_PRIVATE_KEY must be set when BUZZ_REQUIRE_AUTH_TO
- kind:30617 missing d tag
- invalid repo identifier: must be [a-zA-Z0-9._-]{1,64}, no le
- build_ref_state_event: {e}
- sign event
AI-assisted analysis of block/buzz@934f3325c3 (2026-08-20).
Data as JSON: /api/errors/c367354e0317dbf7.
Report an issue: GitHub.