{"record":{"id":"19683d061059c232","repo":"googleapis/mcp-toolbox","slug":"dgraph-instance-v-is-not-in-healthy-state-addr","errorCode":null,"errorMessage":"dgraph instance [%v] is not in healthy state, address is %v","messagePattern":"dgraph instance \\[(.+?)\\] is not in healthy state, address is (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dgraph/dgraph.go","lineNumber":380,"sourceCode":"\tvar result []struct {\n\t\tInstance string `json:\"instance\"`\n\t\tAddress  string `json:\"address\"`\n\t\tStatus   string `json:\"status\"`\n\t}\n\n\t// Unmarshal response into the struct\n\tif err := json.Unmarshal(data, &result); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal json: %v\", err)\n\t}\n\n\tif len(result) == 0 {\n\t\treturn fmt.Errorf(\"health info should not empty for: %v\", url)\n\t}\n\n\tvar unhealthyErr error\n\tfor _, info := range result {\n\t\tif info.Status != \"healthy\" {\n\t\t\tunhealthyErr = fmt.Errorf(\"dgraph instance [%v] is not in healthy state, address is %v\",\n\t\t\t\tinfo.Instance, info.Address)\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn unhealthyErr\n}\n\nfunc getUrl(baseUrl, resource string, params url.Values) (string, error) {\n\tu, err := url.ParseRequestURI(baseUrl)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get url %v\", err)\n\t}\n\tu.Path = resource\n\tu.RawQuery = params.Encode()\n\treturn u.String(), nil\n}","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dgraph/dgraph.go#L362-L398","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the reported instance's logs (docker logs / kubectl logs) to find why it is unhealthy.","Restart the unhealthy Dgraph instance and verify /health then reports status \"healthy\".","Check resource limits (memory/CPU/disk) on the node hosting the unhealthy instance.","If the instance was decommissioned, remove it from the cluster or repoint the source's baseUrl at a healthy instance."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"var entries []struct{ Instance, Address, Status string }\n_ = json.Unmarshal(healthBody, &entries)\nfor _, e := range entries {\n    if e.Status != \"healthy\" {\n        log.Printf(\"warning: dgraph instance %s at %s is %s\", e.Instance, e.Address, e.Status)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := healthCheck(ctx); err != nil {\n    if strings.Contains(err.Error(), \"is not in healthy state\") {\n        alertOps(err) // page on-call: a Dgraph node needs attention\n        return err\n    }\n    return err\n}","preventionTips":["Run Dgraph with health checks/restarts enabled (Docker healthcheck, Kubernetes liveness probe) so unhealthy nodes recover automatically.","Alert on any /health entry whose status is not \"healthy\".","Set resource requests/limits to prevent OOM kills on Alpha nodes.","Decommission dead nodes from the cluster instead of leaving them reporting unhealthy."],"tags":["dgraph","health-check","unhealthy-instance","operations"],"backgroundTag":"service-unhealthy","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}