{"record":{"id":"39f096b342ecc416","repo":"geektutu/7days-golang","slug":"rpc-server-service-method-request-ill-formed","errorCode":null,"errorMessage":"rpc server: service/method request ill-formed: ","messagePattern":"rpc server: service/method request ill-formed: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gee-rpc/day3-service/server.go","lineNumber":110,"sourceCode":"\tmtype        *methodType\n\tsvc          *service\n}\n\nfunc (server *Server) readRequestHeader(cc codec.Codec) (*codec.Header, error) {\n\tvar h codec.Header\n\tif err := cc.ReadHeader(&h); err != nil {\n\t\tif err != io.EOF && err != io.ErrUnexpectedEOF {\n\t\t\tlog.Println(\"rpc server: read header error:\", err)\n\t\t}\n\t\treturn nil, err\n\t}\n\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)","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/geektutu/7days-golang/blob/cf3644382101dc13e7fd92e8f5c66cabc51bcd3b/gee-rpc/day3-service/server.go#L92-L128","documentation":"Request-routing guard in findService: the serviceMethod string has no '.' separator, so it can never be a valid \"ServiceName.MethodName\" pair. It fires for malformed request headers sent by the client, e.g. calling a method without its service prefix.","triggerScenarios":"Thrown at gee-rpc/day3-service/server.go:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call methods with the full \"ServiceName.MethodName\" string, e.g. \"DemoService.Div\".","Check the client's serviceMethod argument for typos or missing dot separators.","Have clients validate the method path before sending the request."],"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"}