{"record":{"id":"fcce8696fd8a1c42","repo":"charmbracelet/gum","slug":"unable-to-run-action-w","errorCode":null,"errorMessage":"unable to run action: %w","messagePattern":"unable to run action: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spin/command.go","lineNumber":47,"sourceCode":"\t\talign:      o.Align,\n\t\tshowStdout: (o.ShowOutput || o.ShowStdout) && isOutTTY,\n\t\tshowStderr: (o.ShowOutput || o.ShowStderr) && isErrTTY,\n\t\tshowError:  o.ShowError,\n\t\tisTTY:      isErrTTY,\n\t\tpadding:    []int{top, right, bottom, left},\n\t}\n\n\tctx, cancel := timeout.Context(o.Timeout)\n\tdefer cancel()\n\n\ttm, err := tea.NewProgram(\n\t\tm,\n\t\ttea.WithOutput(os.Stderr),\n\t\ttea.WithContext(ctx),\n\t\ttea.WithInput(nil),\n\t).Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to run action: %w\", err)\n\t}\n\n\tm = tm.(model)\n\t// If the command succeeds, and we are printing output and we are in a TTY then push the STDOUT we got to the actual\n\t// STDOUT for piping or other things.\n\t//nolint:nestif\n\tif m.err != nil {\n\t\tif _, err := fmt.Fprintf(os.Stderr, \"%s\\n\", m.err.Error()); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write to stdout: %w\", err)\n\t\t}\n\t\treturn exit.ErrExit(1)\n\t} else if m.status == 0 {\n\t\tvar output string\n\t\tif o.ShowOutput || (o.ShowStdout && o.ShowStderr) {\n\t\t\toutput = m.output\n\t\t} else if o.ShowStdout {\n\t\t\toutput = m.stdout\n\t\t} else if o.ShowStderr {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/spin/command.go#L29-L65","documentation":"Gum spin wraps errors from tea.Program.Run() for its spinner/action model. It indicates the bubbletea spinner program failed to start or crashed while the wrapped action command ran. Because spin also redirects output to stderr and nil input, environment problems surface here.","triggerScenarios":"`gum spin -- <command>` in a non-TTY environment, terminal init failure, or ctx cancellation (tea.WithContext) killing the program while the action runs.","commonSituations":"CI/cron invoking gum spin; piping stdin in a way that conflicts with tea.WithInput(nil); terminal lacking required capabilities.","solutions":["Run gum spin in an interactive TTY session.","Check the wrapped error for the root bubbletea cause.","Ensure the parent context is not cancelled early (signals, timeouts).","If automating, drop the spinner and run the command directly."],"exampleFix":"// before (scripting in CI)\ngum spin -- make test\n// after\nmake test","handlingStrategy":"fallback","validationCode":"if [ -t 1 ]; then gum spin -- make test; else make test; fi","typeGuard":null,"tryCatchPattern":"if ! gum spin -- ./build.sh; then echo \"spin or action failed\" >&2; exit 1; fi","preventionTips":["Reserve gum spin for interactive terminals","Don't cancel the parent context mid-run","In CI, run the wrapped command directly without the spinner"],"tags":["tui","bubbletea","spinner","tty"],"backgroundTag":"program-start-failed","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}