googleapis/mcp-toolbox · error

dgraph instance [%v] is not in healthy state, address is %v

Error message

dgraph instance [%v] is not in healthy state, address is %v

What it means

Thrown by the Dgraph source's healthCheck when at least one Dgraph instance in the /health response reports a status other than "healthy". The error names the offending instance and its address. The health check fails so the toolbox can mark the Dgraph source as unhealthy.

Source

Thrown at internal/sources/dgraph/dgraph.go:380

	var result []struct {
		Instance string `json:"instance"`
		Address  string `json:"address"`
		Status   string `json:"status"`
	}

	// Unmarshal response into the struct
	if err := json.Unmarshal(data, &result); err != nil {
		return fmt.Errorf("failed to unmarshal json: %v", err)
	}

	if len(result) == 0 {
		return fmt.Errorf("health info should not empty for: %v", url)
	}

	var unhealthyErr error
	for _, info := range result {
		if info.Status != "healthy" {
			unhealthyErr = fmt.Errorf("dgraph instance [%v] is not in healthy state, address is %v",
				info.Instance, info.Address)
		} else {
			return nil
		}
	}

	return unhealthyErr
}

func getUrl(baseUrl, resource string, params url.Values) (string, error) {
	u, err := url.ParseRequestURI(baseUrl)
	if err != nil {
		return "", fmt.Errorf("failed to get url %v", err)
	}
	u.Path = resource
	u.RawQuery = params.Encode()
	return u.String(), nil
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Inspect the reported instance's logs (docker logs / kubectl logs) to find why it is unhealthy.
  2. Restart the unhealthy Dgraph instance and verify /health then reports status "healthy".
  3. Check resource limits (memory/CPU/disk) on the node hosting the unhealthy instance.
  4. If the instance was decommissioned, remove it from the cluster or repoint the source's baseUrl at a healthy instance.
Defensive patterns

Strategy: fallback

Validate before calling

var entries []struct{ Instance, Address, Status string }
_ = json.Unmarshal(healthBody, &entries)
for _, e := range entries {
    if e.Status != "healthy" {
        log.Printf("warning: dgraph instance %s at %s is %s", e.Instance, e.Address, e.Status)
    }
}

Try / catch

if err := healthCheck(ctx); err != nil {
    if strings.Contains(err.Error(), "is not in healthy state") {
        alertOps(err) // page on-call: a Dgraph node needs attention
        return err
    }
    return err
}

Prevention

When it happens

Trigger: healthCheck iterates the parsed health entries; any entry with info.Status != "healthy" sets unhealthyErr with the instance name and address, which is returned after the loop.

Common situations: A Dgraph Alpha is crashing, OOM-killed, or still booting; a Zero has lost quorum; a recently restarted instance reports unhealthy while recovering; disk or network problems on one node.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/19683d061059c232. Report an issue: GitHub.