tailscale/tailscale · error

load legacy prefs: %w

Error message

load legacy prefs: %w

What it means

Raised by migrateFromLegacyPrefs when loading pre-profile preferences for the user fails. The legacy prefs file is unreadable or malformed, so migration to the profile system cannot proceed.

Source

Thrown at ipn/ipnlocal/profiles.go:986

	if !initialProfile.Valid() {
		var initialUserID ipn.WindowsUserID
		if suf, ok := strings.CutPrefix(string(stateKey), "user-"); ok {
			initialUserID = ipn.WindowsUserID(suf)
		}
		initialProfile = pm.NewProfileForUser(initialUserID)
	}
	if _, _, err := pm.SwitchToProfile(initialProfile); err != nil {
		return nil, err
	}
	return pm, nil
}

func (pm *profileManager) migrateFromLegacyPrefs(uid ipn.WindowsUserID) (ipn.LoginProfileView, error) {
	metricMigration.Add(1)
	sentinel, prefs, err := pm.loadLegacyPrefs(uid)
	if err != nil {
		metricMigrationError.Add(1)
		return ipn.LoginProfileView{}, fmt.Errorf("load legacy prefs: %w", err)
	}
	pm.dlogf("loaded legacy preferences; sentinel=%q", sentinel)
	profile, err := pm.setProfilePrefs(&ipn.LoginProfile{LocalUserID: uid}, prefs, ipn.NetworkProfile{})
	if err != nil {
		metricMigrationError.Add(1)
		return ipn.LoginProfileView{}, fmt.Errorf("migrating _daemon profile: %w", err)
	}
	pm.completeMigration(sentinel)
	pm.dlogf("completed legacy preferences migration with sentinel=%q", sentinel)
	metricMigrationSuccess.Add(1)
	return profile, nil
}

func (pm *profileManager) requiresBackfill() bool {
	return pm != nil &&
		pm.currentProfile.Valid() &&
		pm.currentProfile.NetworkProfile().RequiresBackfill()
}

View on GitHub (pinned to 6e0912f979)

Solutions

  1. Inspect the legacy prefs entry for corruption.
  2. Remove the legacy entry to start with a fresh profile.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at ipn/ipnlocal/profiles.go:986 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tailscale/tailscale@6e0912f979 (2026-08-18). Data as JSON: /api/errors/90c62fc3e93f7fad. Report an issue: GitHub.