{"record":{"id":"b5ae0c2da82e6cd3","repo":"grpc/grpc-go","slug":"error-in-serverrpcevent-method-v","errorCode":null,"errorMessage":"error in serverRPCEvent method: %v","messagePattern":"error in serverRPCEvent method: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gcp/observability/config.go","lineNumber":102,"sourceCode":"\t\tif err := validateMethodString(method); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid method string: %v, err: %v\", method, err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateLoggingEvents(config *config) error {\n\tif config.CloudLogging == nil {\n\t\treturn nil\n\t}\n\tfor _, clientRPCEvent := range config.CloudLogging.ClientRPCEvents {\n\t\tif err := validateLogEventMethod(clientRPCEvent.Methods, clientRPCEvent.Exclude); err != nil {\n\t\t\treturn fmt.Errorf(\"error in clientRPCEvent method: %v\", err)\n\t\t}\n\t}\n\tfor _, serverRPCEvent := range config.CloudLogging.ServerRPCEvents {\n\t\tif err := validateLogEventMethod(serverRPCEvent.Methods, serverRPCEvent.Exclude); err != nil {\n\t\t\treturn fmt.Errorf(\"error in serverRPCEvent method: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// unmarshalAndVerifyConfig unmarshals a json string representing an\n// observability config into its internal go format, and also verifies the\n// configuration's fields for validity.\nfunc unmarshalAndVerifyConfig(rawJSON json.RawMessage) (*config, error) {\n\tvar config config\n\tif err := json.Unmarshal(rawJSON, &config); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing observability config: %v\", err)\n\t}\n\tif err := validateLoggingEvents(&config); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing observability config: %v\", err)\n\t}\n\tif config.CloudTrace != nil && (config.CloudTrace.SamplingRate > 1 || config.CloudTrace.SamplingRate < 0) {\n\t\treturn nil, fmt.Errorf(\"error parsing observability config: invalid cloud trace sampling rate %v\", config.CloudTrace.SamplingRate)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/gcp/observability/config.go#L84-L120","documentation":"Wrapping error 242: at least one entry in a server_rpc_events[].methods list failed validation. Identical in shape to the client-side error but produced when validateLoggingEvents iterates ServerRPCEvents (incoming RPC filters).","triggerScenarios":"A cloud_logging.server_rpc_events item has a malformed methods entry (leading slash, missing/duplicate slash, empty method, or \"*/method\"). Emitted during observability.Start.","commonSituations":"Same authoring mistakes as the client variant, applied to server-side filters; copy-pasting a serviceWildcard pattern that the validator rejects; using a bare service name to mean 'whole service'.","solutions":["Locate the server_rpc_events entry in the error and correct that methods string to <package>.<Service>/<Method>.","For whole-service coverage use \"<package>.<Service>/*\"; for everything use \"*\".","Add a CI check that runs the observability config JSON through validateMethodString before deploy.","Restart the process after fixing the config."],"exampleFix":"// before\n\"server_rpc_events\":[{\"methods\":[\"*/Baz\"]}]\n\n// after\n\"server_rpc_events\":[{\"methods\":[\"*\"]}]","handlingStrategy":"validation","validationCode":"for _, ev := range cfg.CloudLogging.ServerRPCEvents {\n    for _, m := range ev.Methods {\n        if m == \"*\" && ev.Exclude { return errors.New(\"exclude + '*' not allowed\") }\n        if m != \"*\" { if err := validateMethodString(m); err != nil { return err } }\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := observability.Start(ctx); err != nil {\n    if strings.Contains(err.Error(), \"serverRPCEvent method\") {\n        return fmt.Errorf(\"fix server_rpc_events entry: %w\", err)\n    }\n    return err\n}","preventionTips":["Share one method-string linter across client and server filters.","Add example values to the config schema so authors copy a valid pattern.","Run the validator in a pre-deploy hook."],"tags":["observability","config","cloud-logging","server-rpc"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}