{"record":{"id":"49a2b23bc168f5da","repo":"tailscale/tailscale","slug":"parsing-saved-prefs-w","errorCode":null,"errorMessage":"parsing saved prefs: %w","messagePattern":"parsing saved prefs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ipn/ipnlocal/profiles.go","lineNumber":694,"sourceCode":"\t}\n\tsavedPrefs := ipn.NewPrefs()\n\n\t// if supported by the platform, create an empty hardware attestation key to use when deserializing\n\t// to avoid type exceptions from json.Unmarshaling into an interface{}.\n\thw, _ := pm.newEmptyHardwareAttestationKey()\n\tsavedPrefs.Persist = &persist.Persist{\n\t\tAttestationKey: hw,\n\t}\n\n\tif err := ipn.PrefsFromBytes(bs, savedPrefs); err != nil {\n\t\t// Try loading again, this time ignoring the AttestationKey contents.\n\t\t// If that succeeds, there's something wrong with the underlying\n\t\t// attestation key mechanism (most likely the TPM changed), but we\n\t\t// should at least proceed with client startup.\n\t\torigErr := err\n\t\tsavedPrefs.Persist.AttestationKey = &noopAttestationKey{}\n\t\tif err := ipn.PrefsFromBytes(bs, savedPrefs); err != nil {\n\t\t\treturn ipn.PrefsView{}, fmt.Errorf(\"parsing saved prefs: %w\", err)\n\t\t} else {\n\t\t\tpm.logf(\"failed to parse savedPrefs with attestation key (error: %v) but parsing without the attestation key succeeded; will proceed without using the old attestation key\", origErr)\n\t\t}\n\t}\n\tpm.logf(\"using backend prefs for %q: %v\", k, savedPrefs.Pretty())\n\n\t// Ignore any old stored preferences for https://login.tailscale.com\n\t// as the control server that would override the new default of\n\t// controlplane.tailscale.com.\n\tif savedPrefs.ControlURL != \"\" &&\n\t\tsavedPrefs.ControlURL != ipn.DefaultControlURL &&\n\t\tipn.IsLoginServerSynonym(savedPrefs.ControlURL) {\n\t\tsavedPrefs.ControlURL = \"\"\n\t}\n\t// Before\n\t// https://github.com/tailscale/tailscale/pull/11814/commits/1613b18f8280c2bce786980532d012c9f0454fa2#diff-314ba0d799f70c8998940903efb541e511f352b39a9eeeae8d475c921d66c2ac\n\t// prefs could set AutoUpdate.Apply=true via EditPrefs or tailnet\n\t// auto-update defaults. After that change, such value is \"invalid\" and","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/ipn/ipnlocal/profiles.go#L676-L712","documentation":"Raised by loadSavedPrefs when the stored prefs bytes cannot be decoded into ipn.Prefs even after ignoring the attestation key. The persisted state is corrupted or from an incompatible version.","triggerScenarios":"Thrown at ipn/ipnlocal/profiles.go:694 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the prefs JSON in the state store.","Remove the profile's prefs and re-authenticate."],"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-14T05:17:10.506Z"}