can1357/oh-my-pi · error · HTTPException
remote url must not contain params, query, or fragment
Error message
remote url must not contain params, query, or fragment
What it means
Raised when the origin URL contains a params, query string, or fragment component. GitHub remote URLs are plain paths; anything after '?' or '#' (or SVN-style ';params') means the URL is not canonical, so the proxy rejects it before constructing its own clean URL.
Source
Thrown at python/robomp/src/proxy/server.py:330
def _normalized_github_https_url(url: str, expected_repo: str) -> str:
_validate_repo_name(expected_repo)
parsed = urlparse(url)
if (parsed.scheme or "").lower() != "https":
raise HTTPException(400, f"remote url must be https://github.com/{expected_repo}[.git]")
if parsed.username or parsed.password:
raise HTTPException(400, "remote url must not contain embedded credentials")
try:
port = parsed.port
except ValueError as exc:
raise HTTPException(400, "remote url has invalid port") from exc
if port is not None:
raise HTTPException(400, "remote url must not specify a port")
if (parsed.hostname or "").lower() != "github.com":
raise HTTPException(400, f"remote url host must be github.com for repo {expected_repo!r}")
if parsed.params or parsed.query or parsed.fragment:
raise HTTPException(400, "remote url must not contain params, query, or fragment")
path = parsed.path.strip("/")
if path.endswith(".git"):
path = path[:-4]
if path.lower() != expected_repo.lower():
raise HTTPException(400, f"remote url does not match repo {expected_repo!r}")
return _github_url_for_repo(expected_repo)
def _remote_auth_for_url(url: str, expected_repo: str, token: str) -> _RemoteAuth:
raw = url.strip()
if not raw or raw != url:
raise HTTPException(400, "remote url must not be empty or padded")
if _FORBIDDEN_URL_BYTES_RE.search(raw):
raise HTTPException(400, "remote url contains forbidden control bytes")
if raw.startswith("-"):
raise HTTPException(400, "remote url must not start with '-'")
if _REMOTE_HELPER_RE.match(raw):
raise HTTPException(400, "git remote helper transports are disabled")View on GitHub (pinned to 9690622007)
Solutions
- Strip the suffix: set origin to `https://github.com/<owner>/<repo>.git` via `git remote set-url origin`
- Never paste browser URLs (with ?/ #) as git remotes; use the clone button's HTTPS URL
- Check for scripts/templating that append query parameters to remote URLs
Example fix
// before $ git remote set-url origin "https://github.com/acme/repo.git?token=abc" // after $ git remote set-url origin https://github.com/acme/repo.git
Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlparse
def origin_url_is_clean(url: str) -> bool:
p = urlparse(url)
return not (p.params or p.query or p.fragment) Try / catch
from fastapi import HTTPException
try:
result = client.post("/git/op", json={"repo": "acme/repo"})
except HTTPException as e:
if e.status_code == 400 and "params, query, or fragment" in e.detail:
set_origin(worktree_dir, f"https://github.com/{expected_repo}.git")
else:
raise Prevention
- Copy remotes from GitHub's 'Code → Clone → HTTPS' button, never the browser address bar
- Never append tokens or tracking params to remote URLs
- Validate URLs with urlparse before installing them as remotes in scripts
When it happens
Trigger: Proxied git op where parsed.params or parsed.query or parsed.fragment is truthy — e.g. https://github.com/acme/repo.git?token=abc, ...repo.git#main, or legacy SCM-style URLs with ;param sections.
Common situations: Pasting a GitHub web URL (with ?tab=readme or #readme) as a remote; templating tools appending query tokens to the URL; copied URLs from docs containing anchors.
Related errors
- remote url has invalid port
- remote url must be https://github.com/{expected_repo}[.git]
- remote url must not specify a port
- remote url host must be github.com for repo {expected_repo!r
- remote url does not match repo {expected_repo!r}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/b6e78ec244d2cd22.
Report an issue: GitHub.