{"record":{"id":"6ae880b49035ceaf","repo":"lima-vm/lima","slug":"unexpected-answer-d","errorCode":null,"errorMessage":"unexpected answer %d","messagePattern":"unexpected answer (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/start.go","lineNumber":519,"sourceCode":"\t\t\tif tmpl.Name == \"\" {\n\t\t\t\ttmpl.Name, err = limatmpl.InstNameFromYAMLPath(yamlPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\ttmpl, err = limatmpl.Read(ctx, tmpl.Name, yamlPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\terr = tmpl.Embed(ctx, true, true)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\tcase 3: // \"Exit\"\n\t\t\treturn nil, exitSuccessError{Msg: \"Choosing to exit\"}\n\t\tdefault:\n\t\t\treturn tmpl, fmt.Errorf(\"unexpected answer %d\", ans)\n\t\t}\n\t}\n}\n\n// createStartActionCommon is shared by createAction and startAction.\nfunc createStartActionCommon(cmd *cobra.Command, _ []string) (exit bool, err error) {\n\tif listTemplates, err := cmd.Flags().GetBool(\"list-templates\"); err != nil {\n\t\treturn true, err\n\t} else if listTemplates {\n\t\ttemplates, err := filterHiddenTemplates()\n\t\tif err != nil {\n\t\t\treturn true, err\n\t\t}\n\t\tw := cmd.OutOrStdout()\n\t\tfor _, f := range templates {\n\t\t\t_, _ = fmt.Fprintln(w, f.Name)\n\t\t}\n\t\treturn true, nil","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/start.go#L501-L537","documentation":"chooseNextCreatorState presents an interactive 4-option TUI menu (proceed, edit, choose template, exit) via uiutil.Select. This error is thrown when Select returns an answer index outside 0-3, which should be impossible with a well-behaved TUI. It is a defensive guard against out-of-range UI selection values.","triggerScenarios":"uiutil.Select returns an integer >3 (or negative) during `limactl start`/`limactl create` when the instance needs creating and the interactive menu is shown; effectively only occurs from a TUI bug, a broken terminal backend, or a forked/modified option list.","commonSituations":"Running limactl in a non-interactive or misbehaving terminal emulator where the selection library misbehaves; custom builds of Lima with modified menu options but stale switch cases.","solutions":["Retry `limactl start` in a standard interactive terminal (TTY)","Update Lima to the latest version in case of a TUI library bug","Pass the template/YAML directly and use flags to skip the interactive menu (e.g. `limactl start --name X template.yaml`, `--tty=false`)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure a real TTY and stock limactl before interactive start\ntest -t 0 || { echo 'interactive start needs a TTY; use: limactl start --name X template.yaml' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"out=$(limactl start --tty=false template://default --name inst 2>&1) || { echo \"$out\"; }","preventionTips":["Run limactl from a standard interactive terminal","Prefer non-interactive flags (--tty=false, explicit template/name) in scripts","Keep limactl up to date"],"tags":["cli","interactive-tui","limactl-start"],"backgroundTag":"invalid-interactive-menu-selection","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}