charmbracelet/gum · info

not submitted

Error message

not submitted

What it means

gum write (a multi-line textarea prompt) prints the typed text only if the model's `submitted` flag is true. If the user aborts with Esc or Ctrl+C, the program exits cleanly but Run returns `errors.New("not submitted")`. It signals deliberate cancellation, not a crash.

Source

Thrown at write/command.go:83

	}

	m.textarea.KeyMap.InsertNewline = m.keymap.InsertNewline

	ctx, cancel := timeout.Context(o.Timeout)
	defer cancel()

	p := tea.NewProgram(
		m,
		tea.WithOutput(os.Stderr),
		tea.WithContext(ctx),
	)
	tm, err := p.Run()
	if err != nil {
		return fmt.Errorf("failed to run write: %w", err)
	}
	m = tm.(model)
	if !m.submitted {
		return errors.New("not submitted")
	}
	fmt.Println(m.textarea.Value())
	return nil
}

View on GitHub (pinned to 4d089f9550)

Solutions

  1. Treat the non-zero exit as a cancellation branch in your script rather than a failure.
  2. Inform users Enter/Ctrl+D submits and Esc/Ctrl+C cancels.
  3. Use `--value` to prefill content so quick confirmations are easy.
  4. Capture the exit code explicitly to distinguish cancel (this error) from infra failures like `failed to run write`.

Example fix

// before
out=$(gum write) || exit 1 // cannot tell cancel from failure
// after
out=$(gum write); rc=$?
if [ $rc -ne 0 ] && [ -z "$out" ]; then echo "cancelled by user"; exit 0; fi
Defensive patterns

Strategy: try-catch

Try / catch

out=$(gum write) || { echo "write cancelled or failed (rc=$?)" >&2; exit 0; }

Prevention

When it happens

Trigger: User presses Esc or Ctrl+C in the `gum write` editor prompt, ending the Bubble Tea program without confirmation.

Common situations: Users abandoning a multi-line entry; shell scripts where users habitually Ctrl+C; test harnesses that terminate the prompt early.

Related errors


AI-assisted analysis of charmbracelet/gum@4d089f9550 (2026-08-31). Data as JSON: /api/errors/aa84f3b3a0bf60f5. Report an issue: GitHub.