grpc-ecosystem/grpc-gateway · error

invalid field access list for %s

Error message

invalid field access list for %s

What it means

Validation error from Registry.newParam: the field path string resolved to zero FieldPathComponents (resolveFieldPath returns nil for an empty path), so there is no field to build a Parameter from. The faulting input is an empty path expression supplied where a non-empty dotted field path (e.g. 'body.id') is required.

Source

Thrown at internal/descriptor/services.go:256

	//   * body should contain the serialized request message
	rule := &options.HttpRule{
		Pattern: &options.HttpRule_Post{
			Post: fmt.Sprintf("/%s/%s", fqsn, md.GetName()),
		},
		Body: "*",
	}
	return rule, nil
}

func (r *Registry) newParam(meth *Method, path string) (Parameter, error) {
	msg := meth.RequestType
	fields, err := r.resolveFieldPath(msg, path, true)
	if err != nil {
		return Parameter{}, err
	}
	l := len(fields)
	if l == 0 {
		return Parameter{}, fmt.Errorf("invalid field access list for %s", path)
	}
	target := fields[l-1].Target
	switch target.GetType() {
	case descriptorpb.FieldDescriptorProto_TYPE_MESSAGE, descriptorpb.FieldDescriptorProto_TYPE_GROUP:
		if grpclog.V(2) {
			grpclog.Infoln("found aggregate type:", target, target.TypeName)
		}
		if IsWellKnownType(*target.TypeName) {
			if grpclog.V(2) {
				grpclog.Infoln("found well known aggregate type:", target)
			}
		} else {
			return Parameter{}, fmt.Errorf("%s.%s: %s is a protobuf message type. Protobuf message types cannot be used as path parameters, use a scalar value type (such as string) instead", meth.Service.GetName(), meth.GetName(), path)
		}
	}
	return Parameter{
		FieldPath: FieldPath(fields),
		Method:    meth,

View on GitHub (pinned to a58a4436a3)

Solutions

  1. Provide a non-empty field path for the path parameter or body field in the HttpRule.
  2. Fix templates/annotations where a variable name resolves to an empty string.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/descriptor/services.go:256 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grpc-ecosystem/grpc-gateway@a58a4436a3 (2026-09-02). Data as JSON: /api/errors/746a18359004aa3c. Report an issue: GitHub.