{"record":{"id":"ea057e9c08d360c3","repo":"charmbracelet/gum","slug":"not-submitted","errorCode":null,"errorMessage":"not submitted","messagePattern":"not submitted","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"info","filePath":"input/command.go","lineNumber":77,"sourceCode":"\t\tkeymap:      defaultKeymap(),\n\t}\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 input: %w\", err)\n\t}\n\n\tm = tm.(model)\n\tif !m.submitted {\n\t\treturn errors.New(\"not submitted\")\n\t}\n\tfmt.Println(m.textinput.Value())\n\treturn nil\n}\n","sourceCodeStart":59,"sourceCodeEnd":82,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/input/command.go#L59-L82","documentation":"gum input's Run prints the entered text only when the model's `submitted` flag is true, which is set when the user confirms with Enter. If the input was aborted (Esc or Ctrl+C), the program ends normally but nothing was submitted, so Run returns `errors.New(\"not submitted\")`. It is a control-flow signal meaning \"user cancelled\", not an internal failure.","triggerScenarios":"User presses Esc or Ctrl+C inside the `gum input` prompt, causing the Bubble Tea program to quit with submitted=false.","commonSituations":"Users aborting a prompt in interactive scripts; automation driving gum via synthesized key events that send Esc/Ctrl+C; scripts that treat any non-zero exit as a bug when it is just cancellation.","solutions":["Handle the non-zero exit as an expected cancellation path: check the exit status in the calling script and branch on it.","Tell users to press Enter instead of Esc/Ctrl+C to confirm the input.","Provide a default value with `--placeholder`/`--value` so Enter-only workflows complete without typing.","If you need to distinguish cancellation from real failures, match on the message `not submitted` in Go code or on the exit code in shell."],"exampleFix":"// before\nvalue, err := cmd.Output() // treats cancel as unexpected failure\nif err != nil { return err }\n// after (shell)\nvalue=$(gum input --placeholder \"Name\") || { echo \"cancelled\"; exit 0; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if ! value=$(gum input --placeholder \"Name\"); then\n  # exit code 1 = user cancelled (\"not submitted\")\n  echo \"input cancelled\" >&2\n  exit 0\nfi","preventionTips":["Always branch on gum's exit code and treat it as a cancellation signal.","Document Enter vs Esc/Ctrl+C behavior for users of your scripts.","Provide sensible defaults with --value/--placeholder so Enter-only flows work.","Wrap prompts in loops that re-prompt on cancellation instead of failing."],"tags":["go","cli","user-cancelled","bubbletea"],"backgroundTag":"user-aborted-prompt","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}