netbirdio/netbird · error

posture checks name shouldn't be empty

Error message

posture checks name shouldn't be empty

What it means

Returned by Checks.Validate (management/server/posture/checks.go:301): every posture check definition must carry a human-readable name; it is the identifier operators see in policies and the dashboard. The validation runs when a posture check is created or updated through the management API.

Source

Thrown at management/server/posture/checks.go:301

		checks.PeerNetworkRangeCheck = toPeerNetworkRangeCheckResponse(pc.Checks.PeerNetworkRangeCheck)
	}

	if pc.Checks.ProcessCheck != nil {
		checks.ProcessCheck = toProcessCheckResponse(pc.Checks.ProcessCheck)
	}

	return &api.PostureCheck{
		Id:          pc.ID,
		Name:        pc.Name,
		Description: &pc.Description,
		Checks:      checks,
	}
}

// Validate checks the validity of a posture checks.
func (pc *Checks) Validate() error {
	if pc.Name == "" {
		return errors.New("posture checks name shouldn't be empty")
	}

	checks := pc.GetChecks()
	if len(checks) == 0 {
		return errors.New("posture checks shouldn't be empty")
	}

	for _, check := range checks {
		if err := check.Validate(); err != nil {
			return err
		}
	}

	return nil
}

func isVersionValid(ver string) bool {
	newVersion, err := version.NewVersion(ver)

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Set a non-empty name (e.g. "Require NetBird client 0.50+") in the posture check payload
  2. If generating payloads from templates, add a required-field check for name before sending

Example fix

// before
{ "name": "", "description": "ver", "checks": { "nb_version_check": { "min_version": "0.50.0" } } }

// after
{ "name": "Min agent version", "description": "ver", "checks": { "nb_version_check": { "min_version": "0.50.0" } } }
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(req.Name) == "" {
    return errors.New("posture check name is required")
}

Try / catch

_, err := postureAPI.CreateCheck(ctx, req)
if err != nil {
    if strings.Contains(err.Error(), "name shouldn't be empty") {
        // surface a form error on the name field
    }
    return err
}

Prevention

When it happens

Trigger: POST /api/posture-checks (or PUT) with an empty or missing name field in the request body.

Common situations: Automation/Terraform-style scripts building the payload dynamically with an unset name variable; UI form submitted before the name input is filled; API clients that omit optional-looking fields.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/beb239e4b6f918b3. Report an issue: GitHub.