grpc/grpc-go · error
/ must come in between service and method, only one /
Error message
/ must come in between service and method, only one /
What it means
Returned by validateMethodString (gcp/observability/config.go:65) when strings.Split(method, "/") does not yield exactly two parts. This means there is either no '/' at all, or more than one '/' (e.g. 'foo', 'a/b/c'). The observability config requires exactly one '/' separating the fully-qualified service name from the method name.
Source
Thrown at gcp/observability/config.go:65
return ""
}
if credentials.ProjectID == "" {
logger.Infof("Failed to find project ID in default credential: %v", err)
return ""
}
logger.Infof("Found project ID from Google Default Credential: %v", credentials.ProjectID)
return credentials.ProjectID
}
// validateMethodString validates whether the string passed in is a valid
// pattern.
func validateMethodString(method string) error {
if strings.HasPrefix(method, "/") {
return errors.New("cannot have a leading slash")
}
serviceMethod := strings.Split(method, "/")
if len(serviceMethod) != 2 {
return errors.New("/ must come in between service and method, only one /")
}
if serviceMethod[1] == "" {
return errors.New("method name must be non empty")
}
if serviceMethod[0] == "*" {
return errors.New("cannot have service wildcard * i.e. (*/m)")
}
return nil
}
func validateLogEventMethod(methods []string, exclude bool) error {
for _, method := range methods {
if method == "*" {
if exclude {
return errors.New("cannot have exclude and a '*' wildcard")
}
continue
}View on GitHub (pinned to 03255a9237)
Solutions
- Ensure each method entry has exactly one '/' between service and method: <package>.<Service>/<Method>.
- Strip accidental trailing slashes and avoid extra path segments.
- Lint the methods list before deploying the config.
Example fix
// before
{"methods":["foo.Bar"]} // no '/'
{"methods":["foo.Bar/Baz/extra"]} // too many '/'
// after
{"methods":["foo.Bar/Baz"]} Defensive patterns
Strategy: validation
Validate before calling
parts := strings.Split(method, "/")
if len(parts) != 2 || parts[0] == "" {
return fmt.Errorf("method %q must be <service>/<method> with exactly one '/'", method)
} Try / catch
if _, err := unmarshalAndVerifyConfig(raw); err != nil { log.Fatalf("config: %v", err) } Prevention
- Use a config schema/validator (e.g. JSON schema) that enforces the single-slash shape.
When it happens
Trigger: A methods entry that is a bare service name with no method (foo.Bar), a bare method (Bar), an empty string, or contains multiple slashes (a/b/c, foo.Bar/Baz/extra). Reached while parsing the observability config.
Common situations: Typing only the service name; using a path-like method string; concatenating package + service + method with extra slashes; trailing slash (foo.Bar/Baz/).
Related errors
- cannot have a leading slash
- method name must be non empty
- cannot have exclude and a '*' wildcard
- empty token_exchange_service_uri in options
- required field SubjectTokenPath is not specified
AI-assisted analysis of grpc/grpc-go@03255a9237 (2026-08-07).
Data as JSON: /api/errors/0f8e94d1202a05b4.
Report an issue: GitHub.