{"record":{"id":"e67da2fb07828d11","repo":"mislav/hub","slug":"error-using-text-editor-for-s-message","errorCode":null,"errorMessage":"error using text editor for %s message","messagePattern":"error using text editor for (.+?) message","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"github/editor.go","lineNumber":110,"sourceCode":"\t\tunquotedLines = append(unquotedLines, line)\n\t}\n\tif err = scanner.Err(); err != nil {\n\t\treturn\n\t}\n\n\tcontent = strings.Join(unquotedLines, \"\\n\")\n\treturn\n}\n\nfunc (e *Editor) openAndEdit() (content []byte, err error) {\n\terr = e.writeContent()\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = e.openEditor(e.Program, e.File)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"error using text editor for %s message\", e.Topic)\n\t\tdefer e.DeleteFile()\n\t\treturn\n\t}\n\n\tcontent, err = e.readContent()\n\n\treturn\n}\n\nfunc (e *Editor) writeContent() (err error) {\n\tif !e.isFileExist() {\n\t\terr = ioutil.WriteFile(e.File, []byte(e.Message), 0644)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/github/editor.go#L92-L128","documentation":"openAndEdit launches the configured editor (e.g. via EDITOR) on a temporary file for the given topic (commit message, issue title, etc.). If openEditor returns an error (editor binary missing, non-zero exit, spawn failure), the original error is replaced by this generic message and the temp file is deleted. The underlying cause is discarded, which makes debugging harder.","triggerScenarios":"Any EditContent call (e.g. hub pull-request, hub issue create) where the editor cannot be opened: EDITOR points to a nonexistent binary, the editor exits non-zero, or the process cannot be started.","commonSituations":"EDITOR/VISUAL set to a program that isn't installed or isn't on PATH; editors like vim exiting non-zero after a failed write; headless/CI environments with no terminal for interactive editors; git core.editor misconfiguration.","solutions":["Verify EDITOR/VISUAL (or GIT_EDITOR/core.editor) points to an installed program on PATH, e.g. `export EDITOR=vim`.","Run the editor manually on a test file to see the real underlying error, since this message hides it.","Use a non-interactive fallback (`hub issue create -m \"message\"`) to bypass the editor entirely.","Check the editor exits with status 0 on normal save/quit."],"exampleFix":"// before\nEDITOR=\"code\" hub pull-request   // VS Code without --wait waits/hangs, may error\n// after\nexport EDITOR=\"code --wait\"      // or export EDITOR=vim\nhub pull-request","handlingStrategy":"fallback","validationCode":"editor := os.Getenv(\"EDITOR\")\nif editor == \"\" { editor = os.Getenv(\"VISUAL\") }\nif editor == \"\" { editor = \"vim\" }\nif _, err := exec.LookPath(strings.Fields(editor)[0]); err != nil {\n    log.Fatalf(\"editor %q not found on PATH; set EDITOR\", editor)\n}","typeGuard":null,"tryCatchPattern":"content, err := github.EditContent(topic, initial)\nif err != nil && strings.Contains(err.Error(), \"error using text editor\") {\n    fmt.Fprintln(os.Stderr, \"editor failed; falling back to -m flag\")\n    return useMessageFlag() // e.g. hub issue create -m \"text\"\n}","preventionTips":["Set EDITOR/VISUAL to a program that exists on PATH and exits 0","For GUI editors use a blocking variant (e.g. `code --wait`)","In CI/headless environments use -m/-F message flags instead of the editor","Note this error masks the root cause: test the editor binary directly when debugging"],"tags":["editor","environment","process"],"backgroundTag":"editor-launch-failed","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}