GitoxideLabs/gitoxide · error

valid url

Error message

valid url

What it means

Panic from `Url::from_parts(...).expect("valid url")` inside `SpawnProcessOnDemand::new_local` in gix-transport's file protocol. The library constructs a `file://` URL from validated parts (Scheme::File, no host/user/port, a path, accept_ipv6=true) and asserts assembly cannot fail. Only a defect in those invariants — or a fork changing `from_parts` validation — triggers it; user input has normally been sanitized before this point.

Solutions

  1. Upgrade or align `gix-url` and `gix-transport` versions so `from_parts` accepts the file scheme with the given parts.
  2. Check that the local path passed in is a valid non-empty byte path.
  3. Report upstream with the exact path if a stock build panics.
Defensive patterns

Strategy: try-catch

Try / catch

let t = std::panic::catch_unwind(AssertUnwindSafe(|| new_local(path, version, trace)));
if t.is_err() { anyhow::bail!("local transport construction panicked; check gix-url version compatibility"); }

Prevention

When it happens

Trigger: Any local (file/path-based) remote connection, including subprocess spawns of `git upload-pack` for local repos; panic occurs only if `Url::from_parts` rejects the parts, which stock code never does.

Common situations: Forked/patched builds with stricter URL validation; path forms newly rejected by an updated `gix-url` version.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/1f86b568dcb17de5. Report an issue: GitHub.

Appendix: source

Thrown at gix-transport/src/client/blocking_io/file.rs:83

        trace: bool,
    ) -> SpawnProcessOnDemand {
        SpawnProcessOnDemand {
            url,
            path,
            ssh_cmd: Some((program.into(), ssh_kind)),
            envs: Default::default(),
            ssh_disallow_shell,
            child: None,
            connection: None,
            desired_version: version,
            trace,
        }
    }

    fn new_local(path: BString, version: Protocol, trace: bool) -> SpawnProcessOnDemand {
        SpawnProcessOnDemand {
            url: gix_url::Url::from_parts(gix_url::Scheme::File, None, None, None, None, path.clone(), true)
                .expect("valid url"),
            path,
            ssh_cmd: None,
            envs: if version != Protocol::V1 {
                vec![("GIT_PROTOCOL", format!("version={}", version as usize))]
            } else {
                Default::default()
            },
            ssh_disallow_shell: false,
            child: None,
            connection: None,
            desired_version: version,
            trace,
        }
    }

    fn prepare_command(
        &self,
        service: Service,

View on GitHub (pinned to e73179060b)