tailscale/tailscale · error

clearing Service advertisements: %w

Error message

clearing Service advertisements: %w

What it means

On the first successful Up, tsnet clears the AdvertiseServices pref so Service advertisements from previous runs do not persist. The EditPrefs call failed, so stale advertisements may remain visible to the tailnet.

Source

Thrown at tsnet/tsnet.go:610

				}

				// 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
			// and ipn.NeedsMachineAuth to improve the UX of trying
			// out the tsnet package.
			//
			// Unfortunately today, even when using an AuthKey we
			// briefly see these states. It would be nice to fix.
		}
	}
}

View on GitHub (pinned to 57c3357fdb)

Solutions

  1. Inspect the wrapped error from EditPrefs
  2. Retry Up after the backend settles
  3. Manually clear AdvertiseServices if the state store is corrupt
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at tsnet/tsnet.go:582 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/048015ec2553f3a3. Report an issue: GitHub.