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

  1. Add `tsic.WithNetwork(network)` to the option list, using the scenario's network.
  2. Check that the network variable is non-nil before constructing the client.
  3. 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

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


AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15). Data as JSON: /api/errors/aedb9ba743d47553. Report an issue: GitHub.