{"record":{"id":"7eacf7f47f07fdf3","repo":"lima-vm/lima","slug":"redirect-q-must-not-include-a-branch-tag-sha-fr","errorCode":null,"errorMessage":"redirect %#q must not include a branch/tag/sha (from %#q)","messagePattern":"redirect %#q must not include a branch/tag/sha \\(from %#q\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limatmpl/github.go","lineNumber":238,"sourceCode":"\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"file %#q not found or inaccessible: status %d\", resp.Request.URL, resp.StatusCode)\n\t}\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read %#q content: %w\", resp.Request.URL, err)\n\t}\n\treturn validateGitHubRedirect(string(body), org, origBranch, resp.Request.URL.String())\n}\n\nfunc validateGitHubRedirect(body, org, origBranch, url string) (string, error) {\n\tredirect, _, _ := strings.Cut(body, \"\\n\")\n\tredirect = strings.TrimSpace(redirect)\n\n\tif !strings.HasPrefix(redirect, \"github:\"+org+\"/\") {\n\t\treturn \"\", fmt.Errorf(\"redirect %#q is not a `github:%s` URL (from %#q)\", redirect, org, url)\n\t}\n\tif strings.ContainsRune(redirect, '@') {\n\t\treturn \"\", fmt.Errorf(\"redirect %#q must not include a branch/tag/sha (from %#q)\", redirect, url)\n\t}\n\t// If the origBranch is empty, then we need to look up the default branch in the redirect\n\tif origBranch != \"\" {\n\t\tredirect += \"@\" + origBranch\n\t}\n\treturn redirect, nil\n}\n","sourceCodeStart":220,"sourceCodeEnd":246,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limatmpl/github.go#L220-L246","documentation":"validateGitHubRedirect rejects redirect values containing '@', because the branch/tag is appended programmatically (from the original request or the default branch). A pinned redirect like github:ORG/REPO@v1.0 would be ambiguous or could bypass the intended branch propagation, so it fails with \"redirect <value> must not include a branch/tag/sha (from <url>)\".","triggerScenarios":"resolveGitHubSymlink or resolveGitHubRedirect passes redirect content to validateGitHubRedirect and the first line contains '@' anywhere, e.g. github:ORG/REPO@main/path.yaml or a sha-pinned redirect.","commonSituations":"Template authors pinning redirects to a tag or commit SHA for stability; copy-pasting a full github: URL including its @branch into a redirect file; examples written before the no-@ rule was enforced.","solutions":["Remove the @branch/@tag/@sha portion from the redirect file's first line, leaving github:ORG/REPO/PATH","If you need a pinned version, reference that pinned URL directly in your limactl command instead of via the redirect","Update the upstream redirect file and retry"],"exampleFix":"// redirect file first line, before\ngithub:lima-vm/alpine-lim@v1.0\n// after\ngithub:lima-vm/alpine-lim","handlingStrategy":"validation","validationCode":"func redirectHasNoRef(body string) bool {\n    line, _, _ := strings.Cut(body, \"\\n\")\n    return !strings.Contains(line, \"@\")\n}\nif !redirectHasNoRef(redirectFile) {\n    return errors.New(\"redirect must not pin a branch/tag/sha\")\n}","typeGuard":"func isUnpinnedRedirect(content string) bool {\n    line, _, _ := strings.Cut(content, \"\\n\")\n    return !strings.ContainsRune(strings.TrimSpace(line), '@')\n}","tryCatchPattern":"url, err := transformGitHubURL(ctx, ref)\nif err != nil && strings.Contains(err.Error(), \"must not include a branch/tag/sha\") {\n    return fmt.Errorf(\"%w (hint: strip @branch/@tag/@sha from the redirect file's first line)\", err)\n}","preventionTips":["Write redirect first lines without any @ segment","Pin versions in your own github: URL, not in redirect files","Review redirect files for pasted-in @branch fragments","Document the no-@ rule for template authors in your org"],"tags":["validation","github","redirect"],"backgroundTag":"invalid-redirect-target","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}