hasura/graphql-engine · error
error in getting input from editor: %w
Error message
error in getting input from editor: %w
What it means
Thrown by Actions.Create when CaptureInputFromEditor fails — the CLI could not launch the user's preferred editor ($VISUAL/$EDITOR, or a fallback) to collect the GraphQL SDL for the new action. The underlying error is wrapped.
Source
Thrown at cli/internal/metadataobject/actions/actions.go:134
}
sdlToResp, err := a.cliExtensionConfig.ConvertMetadataToSDL(sdlToReq)
if err != nil {
return errors.E(op, fmt.Errorf("error in converting metadata to sdl: %w", err))
}
defaultSDL = sdlToResp.SDL.Complete
}
graphqlFileContent = defaultSDL + "\n" + graphqlFileContent
data, err := editor.CaptureInputFromEditor(
editor.GetPreferredEditorFromEnvironment,
graphqlFileContent,
"graphql",
)
if err != nil {
return errors.E(op, fmt.Errorf("error in getting input from editor: %w", err))
}
sdlFromReq := types.SDLFromRequest{
SDL: types.SDLPayload{
Complete: string(data),
},
}
sdlFromResp, err := a.cliExtensionConfig.ConvertSDLToMetadata(sdlFromReq)
if err != nil {
return errors.E(op, fmt.Errorf("error in converting sdl to metadata: %w", err))
}
currentActionNames := make([]string, 0)
for actionIndex, action := range sdlFromResp.Actions {
if slices.Contains(currentActionNames, action.Name) {
return errors.E(
op,View on GitHub (pinned to 724551b9ae)
Solutions
- Set EDITOR or VISUAL to an available editor, e.g. export EDITOR=vim
- Install a minimal editor in the container (vim/nano) or run the command in an interactive shell
- If non-interactive use is required, use the API/SDK path that supplies SDL directly instead of the editor flow
Example fix
# before (CI, no editor) hasura actions create foo # -> error getting input from editor # after export EDITOR=vi hasura actions create foo
Defensive patterns
Strategy: validation
Validate before calling
if os.Getenv("EDITOR") == "" && os.Getenv("VISUAL") == "" {
os.Setenv("EDITOR", "vi") // ensure a fallback editor exists
} Try / catch
if err := actions.Create(...); err != nil {
if strings.Contains(err.Error(), "error in getting input from editor") {
// set EDITOR/VISUAL or run in an interactive TTY, then retry
}
return err
} Prevention
- Always export EDITOR in scripts and CI containers
- Install a minimal editor (vim/nano) in docker images used for Hasura work
- Avoid editor-dependent commands in non-interactive pipelines
When it happens
Trigger: Running action creation in an environment with no editor available: EDITOR/VISUAL unset and no default editor found, non-interactive shells (CI, docker exec without TTY), or the configured editor command exiting abnormally.
Common situations: CI pipelines or containers where no editor binary exists, EDITOR pointing to a nonexistent command, or ssh sessions without a TTY.
Related errors
- cannot find default editor from env: %w
- error in reading %s file: %w
- action %s already exists in %s
- error in converting metadata to sdl: %w
- error in converting sdl to metadata: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/50ab7c7b8f22d23d.
Report an issue: GitHub.