jdx/mise · error
invalid HTTP setup repository URL; use a Git credential…
Error message
invalid HTTP setup repository URL; use a Git credential helper for authentication
What it means
validate_url additionally parses HTTP/HTTPS remotes with the url crate. If a URL looks like an http(s) URL but fails strict URL parsing, the library rejects it rather than passing a malformed string to git — and the error explicitly points to credential helpers as the supported authentication route, so secrets never end up embedded in the URL.
Solutions
- Fix the URL so it parses strictly as an absolute http(s) URL (scheme, host, path)
- Percent-encode spaces and special characters, or shell-quote when assembling the URL
- Use SSH form (git@host:path) if you don't want an HTTP remote; authenticate via a git credential helper, not the URL
Example fix
// before
let url = format!("https://{}:{}/org/repo.git", user, token); // embedded creds / malformed
// after
let url = "https://host/org/repo.git".to_string();
// authenticate with: git config credential.helper ... or SSH agent Defensive patterns
Strategy: validation
Validate before calling
if (/^https?:/i.test(url)) {
new URL(url); // throws if malformed
} Type guard
function isParsableHttpUrl(v: string): boolean {
return /^https?:/i.test(v) && URL.canParse(v);
} Try / catch
if let Err(e) = validate_url(&value) {
if e.to_string().contains("invalid HTTP setup repository URL") {
eprintln!("{e}; configure a credential helper instead of embedding auth in the URL");
}
return Err(e);
} Prevention
- Assemble URLs with a URL builder, never raw string concatenation
- Validate remotes with the url crate (or equivalent) at config-load time, not at fetch time
- Authenticate via git credential helpers; keep credentials out of URL strings entirely
When it happens
Trigger: validate_url (invoked from fetch_with_depth, push, symbolic_head, ls_remote) receiving a string starting with http:/https: that url::Url::parse rejects — e.g. "https://host repo.git" (spaces), "http:///path" (missing host), unencoded special characters.
Common situations: Hand-edited remote URLs with typos or unescaped spaces; URLs assembled by string concatenation instead of a URL builder; missing scheme/host when templating; migrating a remote and dropping part of the URL.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- remote bootstrap requires HTTPS, SSH, or a local path
- dotfile enrollment metadata must be a regular file
- Git remote helpers are not supported for remote onboarding
- invalid pinned revision
- invalid repository origin
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/49580c52e6132ba2.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/history/sync/network.rs:34
#[error("{0}")]
pub(crate) struct NetworkError(pub String);
/// Authentication belongs in a credential helper or SSH agent, never in
/// persisted connection URLs or the errors recorded in history health.
pub(crate) fn validate_url(value: &str) -> Result<()> {
if value.trim().is_empty() || value.trim_start().starts_with('-') {
bail!("setup repository URL must be nonempty and must not start with '-'");
}
let http_like = value
.trim_start()
.get(..5)
.is_some_and(|prefix| prefix.eq_ignore_ascii_case("http:"))
|| value
.trim_start()
.get(..6)
.is_some_and(|prefix| prefix.eq_ignore_ascii_case("https:"));
if http_like && url::Url::parse(value).is_err() {
bail!("invalid HTTP setup repository URL; use a Git credential helper for authentication");
}
if let Ok(url) = url::Url::parse(value) {
let http = matches!(url.scheme(), "http" | "https");
if url.password().is_some()
|| (http
&& (!url.username().is_empty()
|| url.query().is_some()
|| url.fragment().is_some()))
{
bail!(
"setup repository URLs must not contain credentials, query parameters, or fragments; use a Git credential helper or SSH agent"
);
}
}
Ok(())
}
#[cfg(test)]View on GitHub (pinned to 533346cc37)