tailscale/tailscale · error

clearing serve config: %w

Error message

clearing serve config: %w

What it means

On the first successful Up, tsnet resets the persisted serve config to an empty one to avoid stale handlers from earlier runs. The SetServeConfig call to the local API failed, so old serve entries may still be in effect.

Source

Thrown at tsnet/tsnet.go:601

		}
		if st := n.State; st != nil {
			if *st == ipn.Running {
				status, err := lc.Status(ctx)
				if err != nil {
					return nil, fmt.Errorf("tsnet.Up: %w", err)
				}
				if len(status.TailscaleIPs) == 0 {
					return nil, errors.New("tsnet.Up: running, but no ip")
				}

				// The first time Up is run, clear the persisted serve config
				// and Service advertisements. We do this to prevent messy
				// interactions with stale config in the face of code changes.
				var srvCfgErr error
				var svcAdErr error
				s.resetServeStateOnce.Do(func() {
					if err := lc.SetServeConfig(ctx, new(ipn.ServeConfig)); err != nil {
						srvCfgErr = fmt.Errorf("clearing serve config: %w", err)
					}
					_, err := s.lb.EditPrefs(&ipn.MaskedPrefs{
						AdvertiseServicesSet: true,
						Prefs: ipn.Prefs{
							AdvertiseServices: []string{},
						},
					})
					if err != nil {
						svcAdErr = fmt.Errorf("clearing Service advertisements: %w", err)
					}
				})
				if err := errors.Join(srvCfgErr, svcAdErr); err != nil {
					return nil, fmt.Errorf("tsnet.Up: %w", err)
				}

				return status, nil
			}
			// TODO: in the future, return an error on ipn.NeedsLogin

View on GitHub (pinned to 57c3357fdb)

Solutions

  1. Inspect the wrapped error for the local API failure reason
  2. Delete stale serve config from the state directory if it is corrupt
  3. Retry Up once the backend is stable
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at tsnet/tsnet.go:573 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tailscale/tailscale@57c3357fdb (2026-08-18). Data as JSON: /api/errors/0ed357d775cebbcc. Report an issue: GitHub.