{"record":{"id":"90c62fc3e93f7fad","repo":"tailscale/tailscale","slug":"load-legacy-prefs-w","errorCode":null,"errorMessage":"load legacy prefs: %w","messagePattern":"load legacy prefs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ipn/ipnlocal/profiles.go","lineNumber":986,"sourceCode":"\tif !initialProfile.Valid() {\n\t\tvar initialUserID ipn.WindowsUserID\n\t\tif suf, ok := strings.CutPrefix(string(stateKey), \"user-\"); ok {\n\t\t\tinitialUserID = ipn.WindowsUserID(suf)\n\t\t}\n\t\tinitialProfile = pm.NewProfileForUser(initialUserID)\n\t}\n\tif _, _, err := pm.SwitchToProfile(initialProfile); err != nil {\n\t\treturn nil, err\n\t}\n\treturn pm, nil\n}\n\nfunc (pm *profileManager) migrateFromLegacyPrefs(uid ipn.WindowsUserID) (ipn.LoginProfileView, error) {\n\tmetricMigration.Add(1)\n\tsentinel, prefs, err := pm.loadLegacyPrefs(uid)\n\tif err != nil {\n\t\tmetricMigrationError.Add(1)\n\t\treturn ipn.LoginProfileView{}, fmt.Errorf(\"load legacy prefs: %w\", err)\n\t}\n\tpm.dlogf(\"loaded legacy preferences; sentinel=%q\", sentinel)\n\tprofile, err := pm.setProfilePrefs(&ipn.LoginProfile{LocalUserID: uid}, prefs, ipn.NetworkProfile{})\n\tif err != nil {\n\t\tmetricMigrationError.Add(1)\n\t\treturn ipn.LoginProfileView{}, fmt.Errorf(\"migrating _daemon profile: %w\", err)\n\t}\n\tpm.completeMigration(sentinel)\n\tpm.dlogf(\"completed legacy preferences migration with sentinel=%q\", sentinel)\n\tmetricMigrationSuccess.Add(1)\n\treturn profile, nil\n}\n\nfunc (pm *profileManager) requiresBackfill() bool {\n\treturn pm != nil &&\n\t\tpm.currentProfile.Valid() &&\n\t\tpm.currentProfile.NetworkProfile().RequiresBackfill()\n}","sourceCodeStart":968,"sourceCodeEnd":1004,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/ipn/ipnlocal/profiles.go#L968-L1004","documentation":"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.","triggerScenarios":"Thrown at ipn/ipnlocal/profiles.go:986 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the legacy prefs entry for corruption.","Remove the legacy entry to start with a fresh profile."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}