{"record":{"id":"cffdb3b13b57d5a0","repo":"charmbracelet/gum","slug":"failed-to-write-selected-row-w","errorCode":null,"errorMessage":"failed to write selected row: %w","messagePattern":"failed to write selected row: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"table/command.go","lineNumber":174,"sourceCode":"\t\ttea.WithOutput(os.Stderr),\n\t\ttea.WithContext(ctx),\n\t).Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to start tea program: %w\", err)\n\t}\n\n\tif tm == nil {\n\t\treturn fmt.Errorf(\"failed to get selection\")\n\t}\n\n\tm = tm.(model)\n\tif o.ReturnColumn > 0 && o.ReturnColumn <= len(m.selected) {\n\t\tif err = writer.Write([]string{m.selected[o.ReturnColumn-1]}); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write col %d of selected row: %w\", o.ReturnColumn, err)\n\t\t}\n\t} else {\n\t\tif err = writer.Write([]string(m.selected)); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to write selected row: %w\", err)\n\t\t}\n\t}\n\n\twriter.Flush()\n\n\treturn nil\n}\n","sourceCodeStart":156,"sourceCodeEnd":182,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/table/command.go#L156-L182","documentation":"Gum table failed to write the entire selected row to the output writer (when --return-column is not used or out of range). The writer error is wrapped with %w. Like error 44, the TUI succeeded but emitting the result failed.","triggerScenarios":"No valid `--return-column` (0, unset, or greater than selected row length), `writer.Write([]string(m.selected))` fails — broken stdout pipe, closed descriptor, or IO error.","commonSituations":"Downstream process exits before reading output (SIGPIPE), redirecting to an unwritable path, disk full, or containerized environments with closed stdout.","solutions":["Verify the command's stdout destination is open and writable for the whole run","Don't let downstream consumers close the pipe prematurely","Check disk space/permissions on the redirect target","Read the wrapped %w cause for the precise IO failure"],"exampleFix":"// before\ngum table > /dev/full   # write error: no space\n// after\ngum table > results.txt","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"row=$(gum table < data.csv) || { echo 'failed to write row' >&2; exit 1; }","preventionTips":["Don't pipe gum output into commands that exit early","Redirect to writable files, not full devices","Verify stdout is open in containerized/scripted environments"],"tags":["output","pipe","io"],"backgroundTag":"broken-pipe-write","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}