juanfont/headscale · error
no network set, called from: %s
Error message
no network set, called from: %s
What it means
`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.
Source
Thrown at integration/tsic/tsic.go:366
tsic := &TailscaleInContainer{
version: version,
hostname: hostname,
pool: pool,
}
for _, opt := range opts {
opt(tsic)
}
// Build the entrypoint command dynamically based on options.
// Only build if no custom entrypoint was provided via WithDockerEntrypoint.
if len(tsic.withEntrypoint) == 0 {
tsic.withEntrypoint = tsic.buildEntrypoint()
}
if tsic.network == nil {
return nil, fmt.Errorf("no network set, called from: \n%s", string(debug.Stack())) //nolint:err113
}
tailscaleOptions := &dockertest.RunOptions{
Name: hostname,
Networks: []*dockertest.Network{tsic.network},
Entrypoint: tsic.withEntrypoint,
ExtraHosts: tsic.withExtraHosts,
Env: []string{},
}
if tsic.withWebsocketDERP {
if version != VersionHead {
return tsic, errInvalidClientConfig
}
WithBuildTag("ts_debug_websockets")(tsic)
tailscaleOptions.Env = append(View on GitHub (pinned to 565fd254d0)
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.
Example fix
// before client, err := tsic.New(pool, "head", hostname) // after client, err := tsic.New(pool, "head", hostname, tsic.WithNetwork(network))
Defensive patterns
Strategy: validation
Validate before calling
if network == nil {
return nil, fmt.Errorf("cannot create tailscale client without a docker network")
}
client, err := tsic.New(pool, version, hostname, tsic.WithNetwork(network)) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: New test copies a constructor call but drops the network option; conditional network creation produced nil; refactoring changed how networks are passed.
Related errors
- network does not exist: %s
- %s failed to fetch tailscale status: %w
- running pre-built tailscale container %q: %w
- %s could not start tailscale container (version: %s): %w Do
- creating tailscale node: %w
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/aedb9ba743d47553.
Report an issue: GitHub.