{"record":{"id":"89299b1b33aa5399","repo":"lima-vm/lima","slug":"no-template-available","errorCode":null,"errorMessage":"no template available","messagePattern":"no template available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/autostart/managers.go","lineNumber":117,"sourceCode":"\tif registered, err := t.IsRegistered(ctx, inst); err != nil {\n\t\treturn fmt.Errorf(\"failed to check if the autostart entry for instance %#q is registered: %w\", inst.Name, err)\n\t} else if !registered {\n\t\treturn nil\n\t}\n\tif t.enabler != nil {\n\t\tif err := t.enabler(ctx, false, inst.Name); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to disable the autostart entry for instance %#q: %w\", inst.Name, err)\n\t\t}\n\t}\n\tif err := os.Remove(t.filePath(inst.Name)); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove the autostart entry for instance %#q: %w\", inst.Name, err)\n\t}\n\treturn nil\n}\n\nfunc (t *TemplateFileBasedManager) renderTemplate(instName, workDir string, getExecutable func() (string, error)) ([]byte, error) {\n\tif t.template == \"\" {\n\t\treturn nil, errors.New(\"no template available\")\n\t}\n\tselfExeAbs, err := getExecutable()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := map[string]string{\n\t\t\"Binary\":   selfExeAbs,\n\t\t\"Instance\": instName,\n\t\t\"WorkDir\":  workDir,\n\t}\n\tmaps.Copy(data, t.extraTemplateVars)\n\treturn textutil.ExecuteTemplate(t.template, data)\n}\n\nfunc (t *TemplateFileBasedManager) AutoStartedIdentifier() string {\n\tif t.autoStartedIdentifier != nil {\n\t\treturn t.autoStartedIdentifier()\n\t}","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/autostart/managers.go#L99-L135","documentation":"renderTemplate refuses to run when TemplateFileBasedManager.template is empty; RegisterToStartAtLogin surfaces it (wrapped as \"failed to render the autostart entry...\"). It is a programming/configuration error: an autostart manager was built without the OS-specific unit/plist template.","triggerScenarios":"RegisterToStartAtLogin is called on a TemplateFileBasedManager whose template field was never set — i.e. a manager constructed manually with only some fields, or a custom manager missing its template string.","commonSituations":"Embedding/using the internal autostart package in a fork or custom build and forgetting to set the systemd unit / launchd plist / Windows startup template; constructing TemplateFileBasedManager directly in tests.","solutions":["Use the provided OS-specific constructors (NewSystemd/NewLaunchd/NewWindowsStartup) which populate the template","If building a custom manager, set template to a valid systemd unit file / launchd plist template containing {{.Binary}}, {{.Instance}}, {{.WorkDir}} placeholders"],"exampleFix":"// before\nmgr := &autostart.TemplateFileBasedManager{enabler: enable}\n// after\nmgr := autostart.NewSystemd() // template, filePath, enabler all set","handlingStrategy":"validation","validationCode":"// ensure the manager was built through a constructor with a template\nif mgr == nil || !hasTemplate(mgr) {\n    mgr = autostart.NewSystemd() // or NewLaunchd / NewWindowsStartup\n}\n","typeGuard":"func hasTemplate(m autostart.AutoStartManager) bool {\n    tfbm, ok := m.(*autostart.TemplateFileBasedManager)\n    return ok && tfbm != nil\n}\n","tryCatchPattern":"if err := mgr.RegisterToStartAtLogin(ctx, inst); err != nil {\n    if strings.Contains(err.Error(), \"no template available\") {\n        return errors.New(\"autostart manager misconfigured: use NewSystemd/NewLaunchd constructor\")\n    }\n    return err\n}\n","preventionTips":["Never construct TemplateFileBasedManager by hand; use NewSystemd/NewLaunchd/NewWindowsStartup","When adding a new platform manager, always set template alongside filePath and enabler","Add a unit test that calls renderTemplate/RegisterToStartAtLogin for each manager"],"tags":["autostart","configuration","template"],"backgroundTag":"missing-config-value","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}