zeromicro/go-zero · error

%s: rpc method %s not found

Error message

%s: rpc method %s not found

What it means

Error "%s: rpc method %s not found" thrown in zeromicro/go-zero.

Source

Thrown at gateway/server.go:177

	resolver := grpcurl.AnyResolverFromDescriptorSource(source)
	for _, m := range methods {
		if len(m.HttpMethod) > 0 && len(m.HttpPath) > 0 {
			writer.Write(rest.Route{
				Method:  m.HttpMethod,
				Path:    m.HttpPath,
				Handler: s.buildGrpcHandler(source, resolver, cli, m.RpcPath),
			})
		}
	}

	methodSet := make(map[string]struct{})
	for _, m := range methods {
		methodSet[m.RpcPath] = struct{}{}
	}
	for _, m := range up.Mappings {
		if _, ok := methodSet[m.RpcPath]; !ok {
			cancel(fmt.Errorf("%s: rpc method %s not found", up.Name, m.RpcPath))
			return
		}

		writer.Write(rest.Route{
			Method:  strings.ToUpper(m.Method),
			Path:    m.Path,
			Handler: s.buildGrpcHandler(source, resolver, cli, m.RpcPath),
		})
	}
}

func (s *Server) buildHttpHandler(target *HttpClientConf) http.HandlerFunc {
	handler := func(w http.ResponseWriter, r *http.Request) {
		w.Header().Set(httpx.ContentType, httpx.JsonContentType)
		req, err := buildRequestWithNewTarget(r, target)
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
			return

View on GitHub (pinned to 11f21098dd)

When it happens

Trigger: Thrown at gateway/server.go:177 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeromicro/go-zero@11f21098dd (2026-08-15). Data as JSON: /api/errors/8ad1e1ebfdd5f61f. Report an issue: GitHub.