{"record":{"id":"d4da3fde9418c52d","repo":"geektutu/7days-golang","slug":"rpc-server-can-t-find-method","errorCode":null,"errorMessage":"rpc server: can't find method ","messagePattern":"rpc server: can't find method ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gee-rpc/day3-service/server.go","lineNumber":122,"sourceCode":"\treturn &h, nil\n}\n\nfunc (server *Server) findService(serviceMethod string) (svc *service, mtype *methodType, err error) {\n\tdot := strings.LastIndex(serviceMethod, \".\")\n\tif dot < 0 {\n\t\terr = errors.New(\"rpc server: service/method request ill-formed: \" + serviceMethod)\n\t\treturn\n\t}\n\tserviceName, methodName := serviceMethod[:dot], serviceMethod[dot+1:]\n\tsvci, ok := server.serviceMap.Load(serviceName)\n\tif !ok {\n\t\terr = errors.New(\"rpc server: can't find service \" + serviceName)\n\t\treturn\n\t}\n\tsvc = svci.(*service)\n\tmtype = svc.method[methodName]\n\tif mtype == nil {\n\t\terr = errors.New(\"rpc server: can't find method \" + methodName)\n\t}\n\treturn\n}\n\nfunc (server *Server) readRequest(cc codec.Codec) (*request, error) {\n\th, err := server.readRequestHeader(cc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq := &request{h: h}\n\treq.svc, req.mtype, err = server.findService(h.ServiceMethod)\n\tif err != nil {\n\t\treturn req, err\n\t}\n\treq.argv = req.mtype.newArgv()\n\treq.replyv = req.mtype.newReplyv()\n\n\t// make sure that argvi is a pointer, ReadBody need a pointer as parameter","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/geektutu/7days-golang/blob/cf3644382101dc13e7fd92e8f5c66cabc51bcd3b/gee-rpc/day3-service/server.go#L104-L140","documentation":"Method lookup failure in findService: the service exists in serviceMap but the method name (after the dot) has no entry in svc.method, so the requested exported RPC method is not exposed by that service. It fires for misspelled method names or methods failing the RPC signature rules.","triggerScenarios":"Thrown at gee-rpc/day3-service/server.go:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the method name spelling in the client's serviceMethod string.","Ensure the method satisfies the RPC rules: exported, two exported args (second a pointer), one error return — otherwise it is not registered.","List the service's registered methods to confirm the method was published."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cf3644382101dc13e7fd92e8f5c66cabc51bcd3b","analyzedAt":"2026-09-03T18:31:24.087Z","contentChangedAt":"2026-09-03T18:31:24.087Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}