{"record":{"id":"b87a954e7aade250","repo":"grpc/grpc-go","slug":"error-in-clientrpcevent-method-v","errorCode":null,"errorMessage":"error in clientRPCEvent method: %v","messagePattern":"error in clientRPCEvent method: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gcp/observability/config.go","lineNumber":97,"sourceCode":"\t\t\tif exclude {\n\t\t\t\treturn errors.New(\"cannot have exclude and a '*' wildcard\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\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}","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/gcp/observability/config.go#L79-L115","documentation":"Wrapping error 242: at least one entry in a client_rpc_events[].methods list failed validation. The %v carries the offending method string and the rule it broke. Only client-side (outgoing) RPC event entries produce this path.","triggerScenarios":"A cloud_logging.client_rpc_events item has a malformed methods entry (leading slash, missing/duplicate slash, empty method, or \"*/method\"). Emitted by validateLoggingEvents when iterating ClientRPCEvents during observability.Start.","commonSituations":"Authoring client-side logging filters by copying a fully-qualified gRPC method name with its leading slash; switching a per-service filter to a wildcard incorrectly; bad JSON produced by a config templating step.","solutions":["Find the client_rpc_events entry named in the error and fix that single methods string per the <package>.<Service>/<Method> rule.","Use \"<package>.<Service>/*\" for whole-service matching, or \"*\" for all methods; never \"*/<method>\".","Validate the JSON with a linter that checks method-string shape before deploying.","Restart the binary so observability.Start re-reads the corrected config."],"exampleFix":"// before\n\"client_rpc_events\":[{\"methods\":[\"foo.Bar\",\"foo.Bar/Baz/Qux\"]}]\n\n// after\n\"client_rpc_events\":[{\"methods\":[\"foo.Bar/*\",\"foo.Bar/Baz\"]}]","handlingStrategy":"validation","validationCode":"// Reuse the same validator from error 242 on each client_rpc_events.methods entry.\nfor _, ev := range cfg.CloudLogging.ClientRPCEvents {\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(), \"clientRPCEvent method\") {\n        return fmt.Errorf(\"fix client_rpc_events entry: %w\", err)\n    }\n    return err\n}","preventionTips":["Lint client_rpc_events in CI with the same method-string validator the library uses.","Reject leading slashes at template render time.","Document the method format in the config file with a concrete example."],"tags":["observability","config","cloud-logging","client-rpc"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}