googleapis/mcp-toolbox · error
health info should not empty for: %v
Error message
health info should not empty for: %v
What it means
Thrown by the Dgraph source's healthCheck when the /health endpoint returns valid JSON but the array is empty, so there is no health information to evaluate. The library treats an empty health list as an invalid state for the given URL. Wrapped with %v.
Source
Thrown at internal/sources/dgraph/dgraph.go:374
defer resp.Body.Close()
data, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
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 {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Wait for Dgraph to finish startup and register its instances, then retry the health check.
- Verify the /health endpoint directly: curl http://<host>:<port>/health and confirm a non-empty array is returned.
- Point the source at the correct Dgraph instance (Zero vs Alpha) that actually reports health entries.
- Restart the Dgraph cluster if it reports no members persistently.
Defensive patterns
Strategy: retry
Validate before calling
body, _ := fetchHealth(baseURL)
var entries []map[string]string
_ = json.Unmarshal(body, &entries)
if len(entries) == 0 {
return errors.New("dgraph /health returned an empty array; instance may still be starting")
} Try / catch
if err := healthCheck(ctx); err != nil {
if strings.Contains(err.Error(), "health info should not empty") {
// likely startup timing: wait and retry
time.Sleep(5 * time.Second)
return healthCheck(ctx)
}
return err
} Prevention
- Add startup delays/readiness gates so the toolbox only initializes Dgraph sources after the cluster reports members.
- Monitor the Dgraph cluster (Zero quorum, Alpha registration) independently of the toolbox.
- Re-point the source at an instance known to report health entries.
When it happens
Trigger: healthCheck successfully unmarshals the /health response but len(result) == 0, i.e. Dgraph (or an intermediary) returned an empty JSON array [] for that URL.
Common situations: A Dgraph instance that just started and reports no members yet, a Zero with no Alphas registered, or a proxy stripping/emptying the response body.
Related errors
- error performing request: %w
- failed to unmarshal json: %v
- dgraph instance [%v] is not in healthy state, address is %v
- error parsing JSON: %v
- dgraph url should not be empty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/e7ceedcb0f6ae88e.
Report an issue: GitHub.