gravitational/teleport · info
interrupted
Error message
interrupted
What it means
prompt.ErrInterrupted is a sentinel error returned by the interactive prompt's Run when the user aborts a selection with ctrl-c or when the process receives an interrupt signal while the bubbletea prompt is active. It lets callers distinguish user cancellation from real failures. Check it with errors.Is (the returned error is wrapped via trace.Wrap).
Source
Thrown at lib/utils/prompt/prompt.go:32
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package prompt
import (
"context"
"errors"
"fmt"
"strings"
tea "github.com/charmbracelet/bubbletea"
"github.com/gravitational/trace"
)
// ErrInterrupted is an error when prompt is interrupted with ctrl-c or a signal.
var ErrInterrupted = errors.New("interrupted")
// ErrCanceled is an error when quit option was selected.
var ErrCanceled = errors.New("canceled")
// SelectModel is a generic struct that holds the options, context, and state.
type SelectModel[T any] struct {
caption string
options []T
cursor int
selected *T
renderRow func(T) string
quitting bool
interrupted bool
}
// NewSelectPrompt initializes the generic model with options, a renderer, and a context.
func NewSelectPrompt[T any](caption string, options []T, renderRow func(T) string) SelectModel[T] {
if renderRow == nil {View on GitHub (pinned to 1283425b60)
Solutions
- Treat this as expected user cancellation: return/exit gracefully without logging it as an error.
- Use errors.Is(err, prompt.ErrInterrupted) to detect it (the error is wrapped).
- In non-interactive contexts, avoid opening the prompt at all so no interrupt path is triggered.
Example fix
// before
selected, err := prompt.Run(...)
if err != nil { return err }
// after
selected, err := prompt.Run(...)
if err != nil {
if errors.Is(err, prompt.ErrInterrupted) {
return nil // user canceled, not a failure
}
return err
} Defensive patterns
Strategy: type-guard
Type guard
func isPromptInterrupted(err error) bool {
return errors.Is(err, prompt.ErrInterrupted)
} Try / catch
if err != nil {
if errors.Is(err, prompt.ErrInterrupted) {
return nil // graceful exit on ctrl-c
}
return trace.Wrap(err)
} Prevention
- Always check ErrInterrupted/ErrCanceled (via errors.Is) around prompt.Run calls.
- Skip interactive prompts when stdin is not a TTY.
- Log interruptions at info level, not as errors.
When it happens
Trigger: User presses ctrl-c during a tsh/interactive prompt, or an OS interrupt signal cancels the prompt model, causing Run to return trace.Wrap(ErrInterrupted).
Common situations: Users aborting a certificate/cluster selection prompt in CI where stdin is a terminal that then receives SIGINT; automated scripts piping ctrl-c behavior; long-running prompts aborted by operators.
Related errors
AI-assisted analysis of gravitational/teleport@1283425b60 (2026-09-02).
Data as JSON: /api/errors/179708155093a2f0.
Report an issue: GitHub.