{"record":{"id":"a279a3ce0d8d491e","repo":"charmbracelet/gum","slug":"failed-to-get-selection","errorCode":null,"errorMessage":"failed to get selection","messagePattern":"failed to get selection","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"table/command.go","lineNumber":164,"sourceCode":"\tm := model{\n\t\ttable:     table,\n\t\tshowHelp:  o.ShowHelp,\n\t\thideCount: o.HideCount,\n\t\thelp:      help.New(),\n\t\tkeymap:    defaultKeymap(),\n\t\tpadding:   []int{top, right, bottom, left},\n\t}\n\ttm, err := tea.NewProgram(\n\t\tm,\n\t\ttea.WithOutput(os.Stderr),\n\t\ttea.WithContext(ctx),\n\t).Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to start tea program: %w\", err)\n\t}\n\n\tif tm == nil {\n\t\treturn fmt.Errorf(\"failed to get selection\")\n\t}\n\n\tm = tm.(model)\n\tif o.ReturnColumn > 0 && o.ReturnColumn <= len(m.selected) {\n\t\tif err = writer.Write([]string{m.selected[o.ReturnColumn-1]}); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write col %d of selected row: %w\", o.ReturnColumn, err)\n\t\t}\n\t} else {\n\t\tif err = writer.Write([]string(m.selected)); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write selected row: %w\", err)\n\t\t}\n\t}\n\n\twriter.Flush()\n\n\treturn nil\n}\n","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/table/command.go#L146-L182","documentation":"The Bubble Tea program ran without error but returned a nil final model, so gum cannot extract the user's selection. This is a defensive check against a nil result from tea.Program.Run(). It means no selection state was produced at all.","triggerScenarios":"`tea.NewProgram(...).Run()` returns `tm == nil` — the program exits without producing a final model (abnormal teardown, tea runtime edge cases).","commonSituations":"Terminal teardown anomalies, signal-based abrupt exit paths of the tea runtime, or unusual terminal emulators that crash the program silently.","solutions":["Re-run the command in a standard terminal; this is usually transient","Update gum/Bubble Tea to the latest version to pick up runtime fixes","Avoid sending abnormal signals (SIGKILL/SIGTSTP) during the table display","Check for environment variables (TERM) that may break tea's runtime"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for i in 1 2 3; do\n  sel=$(gum table < data.csv) && break\n  sleep 1\ndone\n[ -n \"$sel\" ] || exit 1","preventionTips":["Avoid sending abnormal signals during the TUI","Keep gum and Bubble Tea up to date","Treat nil-model failures as transient and retry once"],"tags":["tui","bubbletea","nil-model"],"backgroundTag":"tui-nil-result","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}