{"record":{"id":"463181837b752134","repo":"hashicorp/nomad","slug":"resp-warning","errorCode":null,"errorMessage":"resp.Warning","messagePattern":"resp\\.Warning","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/agent.go","lineNumber":146,"sourceCode":"// more nodes have a successful result, no error is returned.\nfunc (a *Agent) Join(addrs ...string) (int, error) {\n\t// Accumulate the addresses\n\tv := url.Values{}\n\tfor _, addr := range addrs {\n\t\tv.Add(\"address\", addr)\n\t}\n\n\t// Send the join request\n\tvar resp joinResponse\n\t_, err := a.client.put(\"/v1/agent/join?\"+v.Encode(), nil, &resp, nil)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed joining: %s\", err)\n\t}\n\tif resp.Error != \"\" {\n\t\treturn 0, fmt.Errorf(\"failed joining: %s\", resp.Error)\n\t}\n\tif resp.Warning != \"\" {\n\t\treturn resp.NumJoined, errors.New(resp.Warning)\n\t}\n\treturn resp.NumJoined, nil\n}\n\n// Members is used to query all of the known server members\nfunc (a *Agent) Members() (*ServerMembers, error) {\n\tvar resp *ServerMembers\n\n\t// Query the known members\n\t_, err := a.client.query(\"/v1/agent/members\", &resp, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}\n\n// MembersOpts is used to query all of the known server members\n// with the ability to set QueryOptions","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/agent.go#L128-L164","documentation":"Agent.Join() sends a join request to a Consul agent; the agent's response can include a Warning field. If the agent reports a non-empty warning, Join returns it as an error (along with NumJoined). Unlike resp.Error, this indicates the join partially succeeded or completed with caveats the agent wants surfaced, e.g. joining by IP with LAN/WAN pool caveats.","triggerScenarios":"Calling Agent.Join(addr) where the agent completes the join but sets resp.Warning — classically when joining with an IPv4/IPv6 address that maps to multiple network pools, or other non-fatal join conditions reported by the agent.","commonSituations":"Dual-stack (IPv4/IPv6) clusters where the join address is ambiguous between LAN and WAN gossip pools; scripted health checks that treat any non-nil error as failure even though NumJoined > 0.","solutions":["Inspect the returned error message: if it is a warning (e.g. about LAN/WAN address pools), the join likely succeeded — verify with Agent.Members().","Join using a resolvable hostname or the address appropriate for the intended network pool to avoid the ambiguity warning.","If automation must tolerate warnings, check the returned NumJoined > 0 and log the warning instead of aborting."],"exampleFix":"// before\nn, err := client.Agent().Join(\"10.0.0.5\", false)\nif err != nil {\n    return err // aborts even though join succeeded with a warning\n}\n// after\nn, err := client.Agent().Join(\"10.0.0.5\", false)\nif err != nil {\n    if n > 0 {\n        log.Warnf(\"join completed with warning: %v\", err)\n    } else {\n        return err\n    }\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"n, err := client.Agent().Join(addr, false)\nif err != nil {\n    if n > 0 {\n        log.Warnf(\"join warning (NumJoined=%d): %v\", n, err)\n        return nil // treat as success but log\n    }\n    return err\n}","preventionTips":["Check NumJoined before treating a Join error as fatal.","Join using unambiguous addresses (hostname or the correct LAN/WAN pool IP) in dual-stack clusters.","After any Join, confirm membership with Agent.Members()."],"tags":["consul","agent","join","warning","gossip"],"backgroundTag":"server-returned-warning","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}