{"record":{"id":"b985c4c19d359916","repo":"tailscale/tailscale","slug":"calling-readstate-on-state-store-w","errorCode":null,"errorMessage":"calling ReadState on state store: %w","messagePattern":"calling ReadState on state store: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ipn/ipnlocal/profiles.go","lineNumber":907,"sourceCode":"\treturn pm.CurrentPrefs(), nil\n}\n\n// newProfileManager creates a new [profileManager] using the provided [ipn.StateStore].\n// It also loads the list of known profiles from the store.\nfunc newProfileManager(store ipn.StateStore, logf logger.Logf, health *health.Tracker) (*profileManager, error) {\n\treturn newProfileManagerWithGOOS(store, logf, health, envknob.GOOS())\n}\n\nfunc readAutoStartKey(store ipn.StateStore, goos string) (ipn.StateKey, error) {\n\tstartKey := ipn.CurrentProfileStateKey\n\tif goos == \"windows\" {\n\t\t// When tailscaled runs on Windows it is not typically run unattended.\n\t\t// So we can't use the profile mechanism to load the profile at startup.\n\t\tstartKey = ipn.ServerModeStartKey\n\t}\n\tautoStartKey, err := store.ReadState(startKey)\n\tif err != nil && err != ipn.ErrStateNotExist {\n\t\treturn \"\", fmt.Errorf(\"calling ReadState on state store: %w\", err)\n\t}\n\treturn ipn.StateKey(autoStartKey), nil\n}\n\nfunc readKnownProfiles(store ipn.StateStore) (map[ipn.ProfileID]ipn.LoginProfileView, error) {\n\tvar knownProfiles map[ipn.ProfileID]ipn.LoginProfileView\n\tprfB, err := store.ReadState(ipn.KnownProfilesStateKey)\n\tswitch err {\n\tcase nil:\n\t\tif err := json.Unmarshal(prfB, &knownProfiles); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unmarshaling known profiles: %w\", err)\n\t\t}\n\tcase ipn.ErrStateNotExist:\n\t\tknownProfiles = make(map[ipn.ProfileID]ipn.LoginProfileView)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"calling ReadState on state store: %w\", err)\n\t}\n\treturn knownProfiles, nil","sourceCodeStart":889,"sourceCodeEnd":925,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/ipn/ipnlocal/profiles.go#L889-L925","documentation":"Raised by readAutoStartKey when reading the current-profile key from the state store fails with something other than not-exist. The state store backend is unreadable, so the profile manager cannot determine which profile to start.","triggerScenarios":"Thrown at ipn/ipnlocal/profiles.go:907 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the state store path and permissions.","Inspect the wrapped backend error."],"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"}