diff --git a/cmd/headscale/cli/nodes.go b/cmd/headscale/cli/nodes.go index 6397c9da..51dbd2c3 100644 --- a/cmd/headscale/cli/nodes.go +++ b/cmd/headscale/cli/nodes.go @@ -543,6 +543,8 @@ var tagCmd = &cobra.Command{ fmt.Sprintf("Error while sending tags to headscale: %s", err), output, ) + + return } if resp != nil { diff --git a/grpcv1.go b/grpcv1.go index e008a4f1..fb6d8e98 100644 --- a/grpcv1.go +++ b/grpcv1.go @@ -8,6 +8,8 @@ import ( v1 "github.com/juanfont/headscale/gen/go/headscale/v1" "github.com/rs/zerolog/log" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "tailscale.com/tailcfg" ) @@ -194,10 +196,12 @@ func (api headscaleV1APIServer) SetTags( for _, tag := range request.GetTags() { if strings.Index(tag, "tag:") != 0 { - return &v1.SetTagsResponse{Machine: nil, Error: &v1.Error{ - Status: 400, - Message: "Invalid tag detected. Each tag must start with the string 'tag:'", - }}, nil + return &v1.SetTagsResponse{ + Machine: nil, + }, status.Error( + codes.InvalidArgument, + "Invalid tag detected. Each tag must start with the string 'tag:'", + ) } }