{"record":{"id":"aedb9ba743d47553","repo":"juanfont/headscale","slug":"no-network-set-called-from-s","errorCode":null,"errorMessage":"no network set, called from: \n%s","messagePattern":"no network set, called from: \n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integration/tsic/tsic.go","lineNumber":366,"sourceCode":"\ttsic := &TailscaleInContainer{\n\t\tversion:  version,\n\t\thostname: hostname,\n\n\t\tpool: pool,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(tsic)\n\t}\n\n\t// Build the entrypoint command dynamically based on options.\n\t// Only build if no custom entrypoint was provided via WithDockerEntrypoint.\n\tif len(tsic.withEntrypoint) == 0 {\n\t\ttsic.withEntrypoint = tsic.buildEntrypoint()\n\t}\n\n\tif tsic.network == nil {\n\t\treturn nil, fmt.Errorf(\"no network set, called from: \\n%s\", string(debug.Stack())) //nolint:err113\n\t}\n\n\ttailscaleOptions := &dockertest.RunOptions{\n\t\tName:       hostname,\n\t\tNetworks:   []*dockertest.Network{tsic.network},\n\t\tEntrypoint: tsic.withEntrypoint,\n\t\tExtraHosts: tsic.withExtraHosts,\n\t\tEnv:        []string{},\n\t}\n\n\tif tsic.withWebsocketDERP {\n\t\tif version != VersionHead {\n\t\t\treturn tsic, errInvalidClientConfig\n\t\t}\n\n\t\tWithBuildTag(\"ts_debug_websockets\")(tsic)\n\n\t\ttailscaleOptions.Env = append(","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/integration/tsic/tsic.go#L348-L384","documentation":"`tsic.New` was called without a `WithNetwork(...)` option (or with a nil network), so the constructor aborts with an error that embeds a stack trace showing the call site. Tailscale containers must attach to a Docker network at creation; there is no default.","triggerScenarios":"Building a TailscaleInContainer via tsic.New and forgetting `tsic.WithNetwork(s.Network())`, or passing a network variable that is nil because an earlier creation step failed.","commonSituations":"New test copies a constructor call but drops the network option; conditional network creation produced nil; refactoring changed how networks are passed.","solutions":["Add `tsic.WithNetwork(network)` to the option list, using the scenario's network.","Check that the network variable is non-nil before constructing the client.","Use the stack trace embedded in the error message to find the exact constructor call that is missing the option."],"exampleFix":"// before\nclient, err := tsic.New(pool, \"head\", hostname)\n\n// after\nclient, err := tsic.New(pool, \"head\", hostname, tsic.WithNetwork(network))","handlingStrategy":"validation","validationCode":"if network == nil {\n    return nil, fmt.Errorf(\"cannot create tailscale client without a docker network\")\n}\nclient, err := tsic.New(pool, version, hostname, tsic.WithNetwork(network))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass tsic.WithNetwork with a non-nil network.","Check network creation errors before building clients.","Use the embedded stack trace to locate the offending constructor call."],"tags":["docker","integration","tailscale","validation"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}