go-task/task · warning
prompt cancelled
Error message
prompt cancelled
What it means
internal/input returns the sentinel ErrCancelled when the user aborts a Bubble Tea prompt (Text or Select) by pressing ctrl+c/esc. It signals that prompt input did not complete, not an internal failure.
Source
Thrown at internal/input/input.go:15
package input
import (
"fmt"
"io"
"strings"
"charm.land/bubbles/v2/textinput"
tea "charm.land/bubbletea/v2"
"charm.land/lipgloss/v2"
"github.com/go-task/task/v3/errors"
)
var ErrCancelled = errors.New("prompt cancelled")
var (
promptStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("6")).Bold(true) // cyan bold
cursorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("6")).Bold(true) // cyan bold
selectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("2")).Bold(true) // green bold
dimStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("8")) // gray
)
// Prompter handles interactive variable prompting
type Prompter struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
// Text prompts the user for a text value
func (p *Prompter) Text(varName string) (string, error) {
m := newTextModel(varName)View on GitHub (pinned to 385e5ad92a)
Solutions
- Re-run the task and complete or answer the prompt
- Use errors.Is(err, input.ErrCancelled) to detect cancellation and exit or substitute defaults
- Run non-interactively (supply the variables up front) to avoid prompts entirely
Example fix
// before
v, _ := p.Text("name")
// after
v, err := p.Text("name")
if errors.Is(err, input.ErrCancelled) {
return fmt.Errorf("prompt cancelled by user")
} Defensive patterns
Strategy: try-catch
Validate before calling
// Nothing to pre-validate: cancellation is a runtime user action.
if !isInteractive(os.Stdin) {
// supply vars up front to avoid prompting
} Type guard
func isPromptCancelled(err error) bool {
return errors.Is(err, input.ErrCancelled)
} Try / catch
v, err := p.Text("name")
if errors.Is(err, input.ErrCancelled) {
// user aborted: exit cleanly or use default
v = defaultValue
} else if err != nil {
return err
} Prevention
- Provide variables on the command line to skip prompts in scripts
- Check errors.Is(err, input.ErrCancelled) rather than comparing error text
- In CI, detect non-TTY stdin and pass all prompted vars explicitly
When it happens
Trigger: Calling Prompter.Text or Prompter.Select and the user cancels; promptDepsVars or promptTaskVars propagate it when variable prompting is aborted.
Common situations: Users hit ctrl+c or esc at an interactive variable prompt during a `task --prompt` / vars-driven run; CI wrappers that expect a value get cancellation instead.
Related errors
- prompt cancelled
- no options provided
- no continue values provided
- enum reference %q must resolve to a list
- enum reference %q must contain only strings
AI-assisted analysis of go-task/task@385e5ad92a (2026-09-05).
Data as JSON: /api/errors/4f8d8d920282ded8.
Report an issue: GitHub.