hasura/graphql-engine · warning

unknown shell: %s. Use bash or zsh

Error message

unknown shell: %s. Use bash or zsh

What it means

Simple validation error from `hasura completion`: the --shell flag (o.Shell) was neither "bash" nor "zsh", so the switch's default branch builds this error directly with fmt.Errorf. Only bash and zsh are supported for completion generation.

Source

Thrown at cli/commands/completion.go:116

		op  errors.Op = "commands.completionOptions.run"
		err error
	)

	switch o.Shell {
	case "bash":
		if o.File != "" {
			err = o.Cmd.Root().GenBashCompletionFile(o.File)
		} else {
			err = o.Cmd.Root().GenBashCompletion(os.Stdout)
		}
	case "zsh":
		if o.File != "" {
			err = o.Cmd.Root().GenZshCompletionFile(o.File)
		} else {
			err = o.Cmd.Root().GenZshCompletion(os.Stdout)
		}
	default:
		err = fmt.Errorf("unknown shell: %s. Use bash or zsh", o.Shell)
	}

	if err != nil {
		return errors.E(op, err)
	}

	return nil
}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Use `--shell bash` or `--shell zsh`.
  2. For other shells, load bash/zsh completion emulation (e.g. fish's bashenv plugin) or wait for upstream support.

Example fix

# before
hasura completion --shell fish
# after
hasura completion --shell bash
Defensive patterns

Strategy: validation

Validate before calling

case "$SHELL_FLAG" in bash|zsh) ;; *) echo "unsupported shell: $SHELL_FLAG"; exit 1;; esac

Type guard

func isSupportedShell(s string) bool { return s == "bash" || s == "zsh" }

Try / catch

Check the message prefix 'unknown shell' and re-run with --shell bash or --shell zsh.

Prevention

When it happens

Trigger: Running `hasura completion --shell fish` (or powershell, cmd, etc.) — any shell name outside {bash, zsh}, including typos like 'zsh ' or case mismatches depending on the switch.

Common situations: Users assuming fish/pwsh support because other CLIs offer it; copy-pasted docs for a different tool; typo'd flag value.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/d70c6e9d959cffc6. Report an issue: GitHub.