{"record":{"id":"e00c375bfe1a53ab","repo":"juanfont/headscale","slug":"network-does-not-exist-s","errorCode":null,"errorMessage":"network does not exist: %s","messagePattern":"network does not exist: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integration/scenario.go","lineNumber":1708,"sourceCode":"\n\treturn nil\n}\n\ntype extraServiceFunc func(*Scenario, string) (*dockertest.Resource, error)\n\nfunc Webservice(s *Scenario, networkName string) (*dockertest.Resource, error) {\n\t// port, err := dockertestutil.RandomFreeHostPort()\n\t// if err != nil {\n\t// \tlog.Fatalf(\"finding open port: %s\", err)\n\t// }\n\t// portNotation := fmt.Sprintf(\"%d/tcp\", port)\n\thash := rands.HexString(hsicOIDCMockHashLength)\n\n\thostname := \"hs-webservice-\" + hash\n\n\tnetwork, ok := s.networks[s.prefixedNetworkName(networkName)]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"network does not exist: %s\", networkName) //nolint:err113\n\t}\n\n\twebOpts := &dockertest.RunOptions{\n\t\tName: hostname,\n\t\tCmd:  []string{\"/bin/sh\", \"-c\", \"cd / ; python3 -m http.server --bind :: 80\"},\n\t\t// ExposedPorts: []string{portNotation},\n\t\t// PortBindings: map[docker.Port][]docker.PortBinding{\n\t\t// \tdocker.Port(portNotation): {{HostPort: strconv.Itoa(port)}},\n\t\t// },\n\t\tNetworks: []*dockertest.Network{network},\n\t\tEnv:      []string{},\n\t}\n\n\t// Add integration test labels if running under hi tool\n\tdockertestutil.DockerAddIntegrationLabels(webOpts, \"web\")\n\n\twebBOpts := &dockertest.BuildOptions{\n\t\tDockerfile: hsic.IntegrationTestDockerFileName,","sourceCodeStart":1690,"sourceCodeEnd":1726,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/scenario.go#L1690-L1726","documentation":"`Webservice(s, networkName)` looks up `s.networks[s.prefixedNetworkName(networkName)]` and the key is absent — the helper only attaches containers to networks the Scenario itself created, and the requested name (after prefixing) does not match any of them.","triggerScenarios":"Passing a network name that was never created via the Scenario, or an unprefixed name when the scenario store keys are prefixed, or a name created after the webservice call.","commonSituations":"Test creates networks manually instead of through the Scenario helper; name typo or prefix mismatch; calling Webservice before network creation.","solutions":["Create the network through the Scenario's network helper so it is registered with the prefixed key.","Print the keys of `s.networks` and use one of those exact (prefixed or correct raw) names.","Check call ordering: network creation must precede Webservice."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check network existence before calling Webservice.\nfound := false\nfor name := range s.networks {\n    if name == s.prefixedNetworkName(networkName) { found = true }\n}\nif !found {\n    t.Fatalf(\"network %q missing; create it via the scenario first\", networkName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always create Docker networks through the Scenario helpers.","Create networks before any container that references them.","Print s.networks keys in test failures to surface prefix mismatches."],"tags":["docker","integration","networking","validation"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}