weaviate/weaviate · error

expected source to contain a usable Resolver, but was %#v

Error message

expected source to contain a usable Resolver, but was %#v

What it means

After newResources confirms p.Source is a map, it asserts source["Resolver"] is the explore.Resolver interface type. If the map exists but lacks a usable Resolver entry (nil or wrong type), this error is returned. Like error 851 it guards internal GraphQL wiring, not user input.

Source

Thrown at adapters/handlers/graphql/local/explore/concepts_resolver.go:56

// RequestsLog is a local abstraction on the RequestsLog that needs to be
// provided to the graphQL API in order to log Local.Fetch queries.
type RequestsLog interface {
	Register(requestType string, identifier string)
}

type resources struct {
	resolver Resolver
}

func newResources(s interface{}) (*resources, error) {
	source, ok := s.(map[string]interface{})
	if !ok {
		return nil, fmt.Errorf("expected source to be a map, but was %T", source)
	}

	resolver, ok := source["Resolver"].(Resolver)
	if !ok {
		return nil, fmt.Errorf("expected source to contain a usable Resolver, but was %#v", source)
	}

	return &resources{
		resolver: resolver,
	}, nil
}

type resolver struct {
	authorizer      authorization.Authorizer
	modulesProvider ModulesProvider
}

func newResolver(authorizer authorization.Authorizer, modulesProvider ModulesProvider) *resolver {
	return &resolver{authorizer, modulesProvider}
}

func (r *resolver) resolve(p graphql.ResolveParams) (interface{}, error) {
	result, err := r.resolveExplore(p)

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Ensure the Explore root source map sets source["Resolver"] to a value implementing explore.Resolver
  2. In tests, construct the source with the real Resolver returned from NewExploreResolver(...)
  3. Grep your patch set for changes to how the Explore root field is registered and restore the Resolver entry
  4. Upgrade to an official release where this wiring is intact

Example fix

// before
src := map[string]interface{}{"resolver": myResolver} // wrong key/type
// after
src := map[string]interface{}{"Resolver": explore.Resolver(myResolver)}
Defensive patterns

Strategy: type-guard

Validate before calling

m, ok := s.(map[string]interface{})
if !ok { return errors.New("not a map") }
if _, ok := m["Resolver"].(Resolver); !ok {
    return errors.New("source missing usable Resolver")
}

Type guard

func hasResolver(m map[string]interface{}) (Resolver, bool) {
    r, ok := m["Resolver"].(Resolver)
    return r, ok
}

Try / catch

resolver, ok := source["Resolver"].(Resolver)
if !ok {
    return nil, fmt.Errorf("missing usable Resolver in %#v", source)
}

Prevention

When it happens

Trigger: The Explore root source map was built without the "Resolver" key, or stored a value that is not assignable to explore.Resolver (nil interface, a different resolver type, or a wrapped pointer).

Common situations: Custom GraphQL schema assembly in a fork; test harnesses that build the source map by hand; refactors that renamed or re-typed the Resolver field in the source map.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/67d1ade688fcec8e. Report an issue: GitHub.