{"record":{"id":"799d476d4844777f","repo":"hasura/graphql-engine","slug":"cannot-find-default-editor-from-env-w","errorCode":null,"errorMessage":"cannot find default editor from env: %w","messagePattern":"cannot find default editor from env: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/seed_create.go","lineNumber":158,"sourceCode":"\t\t\t\treturn errors.E(op, fmt.Errorf(\"exporting seed data: %w\", err))\n\t\t\t}\n\n\t\t\tbody, err = io.ReadAll(bodyReader)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(op, err)\n\t\t\t}\n\t\t} else {\n\t\t\tconst defaultText = \"\"\n\n\t\t\tvar err error\n\n\t\t\tbody, err = editor.CaptureInputFromEditor(\n\t\t\t\teditor.GetPreferredEditorFromEnvironment,\n\t\t\t\tdefaultText,\n\t\t\t\t\"sql\",\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(op, fmt.Errorf(\"cannot find default editor from env: %w\", err))\n\t\t\t}\n\t\t}\n\n\t\tcreateSeedOpts.Data = bytes.NewReader(body)\n\t}\n\n\tfs := afero.NewOsFs()\n\n\tfilepath, err := seed.CreateSeedFile(fs, createSeedOpts)\n\tif err != nil || filepath == nil {\n\t\treturn errors.E(op, fmt.Errorf(\"failed to create seed file: %w\", err))\n\t}\n\n\to.FilePath = *filepath\n\n\treturn nil\n}\n","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/seed_create.go#L140-L176","documentation":"Raised when the CLI cannot capture input from the user's editor while running `hasura seed create` without --from-table. It wraps failures from editor.GetPreferredEditorFromEnvironment (finding $EDITOR/$VISUAL) and from launching/capturing the editor session.","triggerScenarios":"EDITOR and VISUAL environment variables are unset and no default editor can be found, or the resolved editor binary cannot be spawned/exited non-zero during CaptureInputFromEditor.","commonSituations":"CI/cron or container environments with no EDITOR set, ssh sessions without env, a misconfigured EDITOR pointing to a missing binary.","solutions":["Set EDITOR (or VISUAL) to an installed editor: `export EDITOR=vim`","Verify the editor binary exists on PATH (`which $EDITOR`)","In non-interactive contexts, skip the editor by using `--from-table` or pre-create the seed file manually under seeds/"],"exampleFix":"# before\ndocker run hasura/cli seed create s1  # no EDITOR\n# after\ndocker run -e EDITOR=vi hasura/cli seed create s1","handlingStrategy":"validation","validationCode":"// ensure an editor is configured before launching an interactive seed create\nif os.Getenv(\"EDITOR\") == \"\" && os.Getenv(\"VISUAL\") == \"\" {\n    return errors.New(\"set $EDITOR (e.g. export EDITOR=vim) or use --from-table\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set EDITOR in devcontainers/CI images used for interactive CLI work","Prefer --from-table or writing seeds/*.sql files directly in automation"],"tags":["hasura","editor","env-var","cli","seed"],"backgroundTag":"missing-env-var","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}