grafana/k6 · error

method not found in file descriptors

Error message

method %q not found in file descriptors

What it means

Raised in buildInvokeRequest (used by Invoke/AsyncInvoke) when the fully-qualified method name (after a leading '/' is ensured) has no matching entry in the descriptor map loaded via load(), LoadProtoset, or reflection.

Solutions

  1. Use the fully-qualified name '/package.Service/Method' exactly as defined in the proto
  2. Verify the proto containing the method was loaded before connect/invoke
  3. Check package name and service name spelling against the .proto source
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/grpc/client.go:366 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@8d06114777 (2026-08-18). Data as JSON: /api/errors/c2878656649a7246. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/grpc/client.go:397

) (grpcext.InvokeRequest, error) {
	grpcReq := grpcext.InvokeRequest{}

	state := c.vu.State()
	if state == nil {
		return grpcReq, common.NewInitContextError("invoking RPC methods in the init context is not supported")
	}
	if c.conn == nil {
		return grpcReq, errors.New("no gRPC connection, you must call connect first")
	}
	if method == "" {
		return grpcReq, errors.New("method to invoke cannot be empty")
	}
	if method[0] != '/' {
		method = "/" + method
	}
	methodDesc := c.mds[method]
	if methodDesc == nil {
		return grpcReq, fmt.Errorf("method %q not found in file descriptors", method)
	}

	p, err := newCallParams(c.vu, params)
	if err != nil {
		return grpcReq, fmt.Errorf("invalid GRPC's client.invoke() parameters: %w", err)
	}

	// k6 GRPC Invoke's default timeout is 2 minutes
	if p.Timeout == time.Duration(0) {
		p.Timeout = 2 * time.Minute
	}

	if req == nil {
		return grpcReq, errors.New("request cannot be nil")
	}

	object := req.ToObject(c.vu.Runtime())

View on GitHub (pinned to 8d06114777)