{"record":{"id":"4d40b6554c4206f3","repo":"lima-vm/lima","slug":"don-t-know-how-to-interpret-q-as-a-template-loca","errorCode":null,"errorMessage":"don't know how to interpret %#q as a template locator","messagePattern":"don't know how to interpret %#q as a template locator","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/template.go","lineNumber":138,"sourceCode":"\tverbatim, err := cmd.Flags().GetBool(\"verbatim\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif fill {\n\t\tembedAll = true\n\t}\n\tif embedAll {\n\t\tembed = true\n\t}\n\tif embed && verbatim {\n\t\treturn errors.New(\"--verbatim cannot be used with any of --embed, --embed-all, or --fill\")\n\t}\n\ttmpl, err := limatmpl.Read(ctx, \"\", source)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(tmpl.Bytes) == 0 {\n\t\treturn fmt.Errorf(\"don't know how to interpret %#q as a template locator\", source)\n\t}\n\tif !verbatim {\n\t\tif embed {\n\t\t\t// Embed default base.yaml only when fill is true.\n\t\t\tif err := tmpl.Embed(ctx, embedAll, fill); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tif err := tmpl.UseAbsLocators(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif fill {\n\t\tif err := fillDefaults(ctx, tmpl); err != nil {\n\t\t\treturn err\n\t\t}\n\t}","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/template.go#L120-L156","documentation":"`limactl template copy` calls `limatmpl.Read` on the source locator; Read returns a Template with empty Bytes when the locator matched an image-URL pattern (img/iso/etc.) rather than a YAML template. The action then rejects it because there is no template content to copy. It is a user-input classification error, not an internal failure.","triggerScenarios":"Running `limactl template copy <src> <dst>` where src resolves to a VM image locator (e.g. a URL or path ending in .img, .qcow2, .raw, .iso, .ipsw, optionally compressed) instead of a YAML template, or an empty/unreadable source that produced zero bytes.","commonSituations":"Passing a disk image URL copied from a release page instead of a template YAML; expecting `template copy` to duplicate a base image; typos like copying an .iso file; pointing at an empty file.","solutions":["Pass a YAML template locator (a template name like `default`, a local .yaml path, an http(s) URL to YAML, or `-` for stdin) as the source","If you meant to copy a VM image, use the image in a template's images list instead of `template copy`","Check the extension/URL of the source; rename or point to the .yaml file","Run `limactl template ls` to list valid template names"],"exampleFix":"// before\nlimactl template copy https://example.com/ubuntu-24.04.img my.yaml\n// after\nlimactl template copy template://default my-copy.yaml  # or a path to a .yaml file","handlingStrategy":"validation","validationCode":"func isValidTemplateLocator(src string) bool {\n\tif src == \"-\" || strings.HasSuffix(src, \".yaml\") || strings.HasSuffix(src, \".yml\") {\n\t\treturn true\n\t}\n\timageRe := regexp.MustCompile(`\\.(img|qcow2|raw|iso|ipsw)(\\.(gz|xz|bz2|zstd))?$`)\n\treturn !imageRe.MatchString(src)\n}\nif !isValidTemplateLocator(source) {\n\treturn fmt.Errorf(\"%q is a VM image, not a YAML template\", source)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass .yaml/.yml files or template:// names to `template copy`","Never point template commands at disk images (.img/.iso/...); images belong in a template's images list","Use `limactl template ls` to discover valid built-in template names","Check file size > 0 before passing a local file as a template"],"tags":["cli","template","locator"],"backgroundTag":"invalid-template-locator","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}