lima-vm/lima · error
redirect %#q is not a `github:%s` URL (from %#q)
Error message
redirect %#q is not a `github:%s` URL (from %#q)
What it means
validateGitHubRedirect enforces that a github: redirect file found in an ORG==REPO repo points back into the same org: the first line must start with "github:<ORG>/". If it points to another org, an http(s) URL, or arbitrary text, the fetch fails with "redirect <value> is not a `github:<ORG>` URL (from <url>)". This prevents redirect files from pulling templates from arbitrary orgs.
Source
Thrown at pkg/limatmpl/github.go:235
return "", fmt.Errorf("failed to fetch file: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("file %#q not found or inaccessible: status %d", resp.Request.URL, resp.StatusCode)
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("failed to read %#q content: %w", resp.Request.URL, err)
}
return validateGitHubRedirect(string(body), org, origBranch, resp.Request.URL.String())
}
func validateGitHubRedirect(body, org, origBranch, url string) (string, error) {
redirect, _, _ := strings.Cut(body, "\n")
redirect = strings.TrimSpace(redirect)
if !strings.HasPrefix(redirect, "github:"+org+"/") {
return "", fmt.Errorf("redirect %#q is not a `github:%s` URL (from %#q)", redirect, org, url)
}
if strings.ContainsRune(redirect, '@') {
return "", fmt.Errorf("redirect %#q must not include a branch/tag/sha (from %#q)", redirect, url)
}
// If the origBranch is empty, then we need to look up the default branch in the redirect
if origBranch != "" {
redirect += "@" + origBranch
}
return redirect, nil
}
View on GitHub (pinned to dd909d0973)
Solutions
- Edit the redirect file in the source repo to start with github:<ORG>/ where ORG matches the repo owner
- If the template moved to another org, reference the new org's repo directly instead of going through the redirect
- If the file is not meant to be a redirect, change its first line so it does not start with "github:"
- Check for org renames and update the redirect accordingly
Example fix
// redirect file first line, before github:moved-org/templates/alpine.yaml // after github:lima-vm/lima/templates/alpine.yaml
Defensive patterns
Strategy: validation
Validate before calling
func validRedirect(body, org string) bool {
line, _, _ := strings.Cut(body, "\n")
line = strings.TrimSpace(line)
return strings.HasPrefix(line, "github:"+org+"/")
}
// validate redirect files before relying on them Type guard
func isSameOrgRedirect(content, org string) bool {
if !strings.HasPrefix(content, "github:") { return false }
line, _, _ := strings.Cut(content, "\n")
return strings.HasPrefix(strings.TrimSpace(line), "github:"+org+"/")
} Try / catch
url, err := transformGitHubURL(ctx, ref)
if err != nil && strings.Contains(err.Error(), "is not a `github:") {
return fmt.Errorf("%w (hint: the redirect file must point back into the same org; reference the new org's repo directly)", err)
} Prevention
- Keep redirect first lines as github:<same-ORG>/REPO/PATH
- Never point redirect files at other orgs — fetch those directly
- Ensure redirect files' first line actually starts with github: to avoid misclassification
- Update redirects after org/account renames
When it happens
Trigger: resolveGitHubSymlink sees content starting with "github:" in a repo where repo==org (or resolveGitHubRedirect reads the default-branch copy) and hands it to validateGitHubRedirect; the first line's prefix does not match github:<same-org>/ — e.g. it says github:other-org/... or github:org (no slash/path).
Common situations: A redirect file updated to point to a template moved to a different org; hand-edited redirect with a typo in the org segment; a file that merely begins with the text "github:" but is not a redirect (misdetected because the file's first line looks like a URL); renamed GitHub org or account.
Related errors
- redirect %#q must not include a branch/tag/sha (from %#q)
- disk format %#q not supported, use `qcow2` or `raw` instead
- the YAML is invalid, attempted to save the buffer as %#q but
- the YAML is invalid, saved the buffer as %#q: %w
- invalid port forward format %#q, expected HOST:GUEST or HOST
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/8521575f532f2572.
Report an issue: GitHub.