{"record":{"id":"aa84f3b3a0bf60f5","repo":"charmbracelet/gum","slug":"not-submitted-aa84f3","errorCode":null,"errorMessage":"not submitted","messagePattern":"not submitted","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"info","filePath":"write/command.go","lineNumber":83,"sourceCode":"\t}\n\n\tm.textarea.KeyMap.InsertNewline = m.keymap.InsertNewline\n\n\tctx, cancel := timeout.Context(o.Timeout)\n\tdefer cancel()\n\n\tp := tea.NewProgram(\n\t\tm,\n\t\ttea.WithOutput(os.Stderr),\n\t\ttea.WithContext(ctx),\n\t)\n\ttm, err := p.Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to run write: %w\", err)\n\t}\n\tm = tm.(model)\n\tif !m.submitted {\n\t\treturn errors.New(\"not submitted\")\n\t}\n\tfmt.Println(m.textarea.Value())\n\treturn nil\n}\n","sourceCodeStart":65,"sourceCodeEnd":88,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/write/command.go#L65-L88","documentation":"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.","triggerScenarios":"User presses Esc or Ctrl+C in the `gum write` editor prompt, ending the Bubble Tea program without confirmation.","commonSituations":"Users abandoning a multi-line entry; shell scripts where users habitually Ctrl+C; test harnesses that terminate the prompt early.","solutions":["Treat the non-zero exit as a cancellation branch in your script rather than a failure.","Inform users Enter/Ctrl+D submits and Esc/Ctrl+C cancels.","Use `--value` to prefill content so quick confirmations are easy.","Capture the exit code explicitly to distinguish cancel (this error) from infra failures like `failed to run write`."],"exampleFix":"// before\nout=$(gum write) || exit 1 // cannot tell cancel from failure\n// after\nout=$(gum write); rc=$?\nif [ $rc -ne 0 ] && [ -z \"$out\" ]; then echo \"cancelled by user\"; exit 0; fi","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"out=$(gum write) || { echo \"write cancelled or failed (rc=$?)\" >&2; exit 0; }","preventionTips":["Treat non-zero exit from gum write as a user-cancellation branch.","Prefill with --value to reduce aborted sessions.","Show submit/cancel key hints in surrounding UI text.","Differentiate this error from `failed to run write` by checking output emptiness and exit code."],"tags":["go","cli","user-cancelled","textarea"],"backgroundTag":"user-aborted-prompt","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}