cayleygraph/cayley · error

unsupported query language: %q

Error message

unsupported query language: %q

What it means

This error means the REPL could not find a usable query language implementation for the requested name. query.GetLanguage(queryLanguage) returned nil, or the language has no Session factory, so there is no way to start an interactive session. Cayley aborts the REPL rather than silently defaulting to a different language.

Source

Thrown at internal/repl/repl.go:96

	return nil
}

const (
	defaultLanguage = "gizmo"

	ps1 = "cayley> "
	ps2 = "...     "

	history = ".cayley_history"
)

func Repl(ctx context.Context, h *graph.Handle, queryLanguage string, timeout time.Duration) error {
	if queryLanguage == "" {
		queryLanguage = defaultLanguage
	}
	l := query.GetLanguage(queryLanguage)
	if l == nil || l.Session == nil {
		return fmt.Errorf("unsupported query language: %q", queryLanguage)
	}
	ses := l.Session(h.QuadStore)

	term, err := terminal(history)
	if os.IsNotExist(err) {
		fmt.Printf("creating new history file: %q\n", history)
	}
	defer persist(term, history)

	var (
		prompt = ps1

		code string
	)

	newCtx := func() (context.Context, func()) { return ctx, func() {} }
	if timeout > 0 {
		newCtx = func() (context.Context, func()) { return context.WithTimeout(ctx, timeout) }

View on GitHub (pinned to 81dcd7d73e)

Solutions

  1. Check the language name spelling and casing against registered languages (e.g. "gizmo", "graphql").
  2. Ensure the corresponding query language package is imported/linked into your build (binary distributions include all; custom builds may not).
  3. Run without --query-language to use the default language and confirm what it resolves to.
  4. Update Cayley if your version renamed the language you want.

Example fix

// before
cayley repl --query-language Gizmo
// after
cayley repl --query-language gizmo
Defensive patterns

Strategy: validation

Validate before calling

l := query.GetLanguage(lang)
if l == nil || l.Session == nil {
	// pick "gizmo" or register the language package before starting the REPL
}

Prevention

When it happens

Trigger: Calling internal/repl.Repl (via the `cayley repl` command) with a queryLanguage string that is not registered — e.g. a misspelled name like 'gizmo'/'Gizmo' case mismatch, 'graphql' when the graphql package was never imported/registered in the build, or an empty string that still fails because no default language registered a Session.

Common situations: Typo in --query-language flag; using a slim build that omits the graphql or gizmo query language packages; case-sensitivity mistakes ('gizmo' vs 'Gizmo' — names are registered with exact casing); older versions where the language name changed.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of cayleygraph/cayley@81dcd7d73e (2026-09-06). Data as JSON: /api/errors/1e82e131762d0801. Report an issue: GitHub.