{"record":{"id":"c367354e0317dbf7","repo":"block/buzz","slug":"invalid-url-url-e","errorCode":null,"errorMessage":"invalid URL {url:?}: {e}","messagePattern":"invalid URL (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/git-credential-nostr/src/lib.rs","lineNumber":226,"sourceCode":"    let mut raw_key = match load_key() {\n        Ok(k) => k,\n        Err(e) => {\n            eprintln!(\"error: {e}\");\n            return 1;\n        }\n    };\n\n    let keys = match Keys::parse(&raw_key) {\n        Ok(k) => k,\n        Err(e) => {\n            raw_key.zeroize();\n            eprintln!(\"error: invalid nostr private key: {e}\");\n            return 1;\n        }\n    };\n    raw_key.zeroize();\n\n    let parsed_url = Url::parse(&url).unwrap_or_else(|e| panic!(\"invalid URL {url:?}: {e}\"));\n    let http_data = HttpData::new(parsed_url, method);\n    let auth_tag = match load_auth_tag() {\n        Ok(tag) => tag,\n        Err(e) => {\n            eprintln!(\"error: {e}\");\n            return 1;\n        }\n    };\n    let builder = EventBuilder::http_auth(http_data);\n    let builder = match auth_tag {\n        Some(tag) => builder.tag(tag),\n        None => builder,\n    };\n    let event = match builder.sign_with_keys(&keys) {\n        Ok(e) => e,\n        Err(e) => {\n            eprintln!(\"error: failed to sign NIP-98 event: {e}\");\n            return 1;","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/block/buzz/blob/934f3325c3fdaa3a6f23134b74518139aac8ca3f/crates/git-credential-nostr/src/lib.rs#L208-L244","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// crates/git-credential-nostr/src/lib.rs\n// before\nlet parsed_url = Url::parse(&url).unwrap_or_else(|e| panic!(\"invalid URL {url:?}: {e}\"));\n// after\nlet parsed_url = match Url::parse(&url) {\n    Ok(u) => u,\n    Err(e) => {\n        eprintln!(\"error: invalid URL {url:?}: {e}\");\n        return 1;\n    }\n};","handlingStrategy":"validation","validationCode":"// Validate the assembled URL the same way the helper does, before invoking git\nlet candidate = format!(\"{protocol}://{host}/{repo_path}\");\nif url::Url::parse(&candidate).is_err() {\n    eprintln!(\"remote URL is not parseable: {candidate} — fix the git remote\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"// In the helper itself: never panic in a credential-helper process —\n// write the error to stderr and exit non-zero so git reports auth failure\nlet parsed_url = match Url::parse(&url) {\n    Ok(u) => u,\n    Err(e) => { eprintln!(\"error: invalid URL {url:?}: {e}\"); return 1; }\n};","preventionTips":["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"],"tags":["git","credential-helper","url","nostr","nip-98","panic"],"backgroundTag":"url-parse-failed","analyzedSha":"934f3325c3fdaa3a6f23134b74518139aac8ca3f","analyzedAt":"2026-08-20T04:38:24.874Z","contentChangedAt":"2026-08-20T04:38:24.874Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}