{"record":{"id":"11670ec1a7c19d19","repo":"juanfont/headscale","slug":"no-ipam-config-found-in-network-s","errorCode":null,"errorMessage":"no IPAM config found in network: %s","messagePattern":"no IPAM config found in network: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integration/scenario.go","lineNumber":339,"sourceCode":"}\n\nfunc (s *Scenario) Network(name string) (*dockertest.Network, error) {\n\tnet, ok := s.networks[s.prefixedNetworkName(name)]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no network named: %s\", name) //nolint:err113\n\t}\n\n\treturn net, nil\n}\n\nfunc (s *Scenario) SubnetOfNetwork(name string) (*netip.Prefix, error) {\n\tnet, ok := s.networks[s.prefixedNetworkName(name)]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no network named: %s\", name) //nolint:err113\n\t}\n\n\tif len(net.Network.IPAM.Config) == 0 {\n\t\treturn nil, fmt.Errorf(\"no IPAM config found in network: %s\", name) //nolint:err113\n\t}\n\n\tpref, err := netip.ParsePrefix(net.Network.IPAM.Config[0].Subnet)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &pref, nil\n}\n\nfunc (s *Scenario) Services(name string) ([]*dockertest.Resource, error) {\n\tres, ok := s.extraServices[s.prefixedNetworkName(name)]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no network named: %s\", name) //nolint:err113\n\t}\n\n\treturn res, nil\n}","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/scenario.go#L321-L357","documentation":"Returned by Scenario.SubnetOfNetwork(name) when the Docker network exists but its IPAM config list is empty, so no subnet CIDR can be derived. The network object came back from Docker without an assigned address pool.","triggerScenarios":"Calling SubnetOfNetwork on a network that was created without an explicit subnet and whose IPAM config was not populated, or on an externally created network attached to the scenario lacking IPAM metadata.","commonSituations":"Using AddNetwork (empty subnet) then immediately asking for the subnet; Docker driver (e.g. ipvlan/macvlan or pre-created networks) that does not populate Network.Network.IPAM.Config; inspecting a network created by another tool.","solutions":["Create the network with an explicit subnet: s.AddNetworkWithSubnet(name, \"172.10.0.0/24\")","Inspect the network with `docker network inspect <name>` to confirm IPAM config exists before relying on SubnetOfNetwork","If the network is pre-existing, recreate it through the scenario so IPAM is guaranteed populated"],"exampleFix":"// before\n_, err := scenario.AddNetwork(\"mynet\")\n// ...\npref, err := scenario.SubnetOfNetwork(\"mynet\")\n\n// after\n_, err := scenario.AddNetworkWithSubnet(\"mynet\", \"172.10.0.0/24\")\n// ...\npref, err := scenario.SubnetOfNetwork(\"mynet\")","handlingStrategy":"validation","validationCode":"// Guard: only expect IPAM data when the subnet was declared explicitly\nconst subnet = \"172.10.0.0/24\"\nif _, err := scenario.AddNetworkWithSubnet(name, subnet); err != nil {\n    t.Fatal(err)\n}","typeGuard":null,"tryCatchPattern":"pref, err := scenario.SubnetOfNetwork(name)\nif err != nil {\n    t.Fatalf(\"network %q has no IPAM config (was it created without a subnet?): %v\", name, err)\n}","preventionTips":["Always pass an explicit CIDR when the test later needs the subnet","Do not rely on IPAM for networks you did not create through the scenario"],"tags":["docker","network","ipam","integration-test"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}