{"record":{"id":"112372118382cd54","repo":"octobercms/october","slug":"there-is-no-an-authenticated-user-to-load-or-save","errorCode":null,"errorMessage":"There is no an authenticated user to load or save preferences for.","messagePattern":"There is no an authenticated user to load or save preferences for\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/backend/models/UserPreference.php","lineNumber":41,"sourceCode":"    public $timestamps = false;\n\n    /**\n     * @var array cache\n     */\n    protected static $cache = [];\n\n    /**\n     * resolveUser checks for a supplied user or uses the default logged in. You should\n     * override this method\n     *\n     * @param mixed $user An optional back-end user object.\n     * @return User object\n     */\n    public function resolveUser($user)\n    {\n        $user = BackendAuth::getUser();\n        if (!$user) {\n            throw new SystemException(trans('backend::lang.user.preferences.not_authenticated'));\n        }\n\n        return $user;\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":47,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/models/UserPreference.php#L23-L47","documentation":"Thrown by UserPreference::resolveUser when BackendAuth::getUser() returns null — the preference store was asked to load or save preferences without an authenticated backend user. It is a session/context guard: preferences are per-user, and code paths running outside an authenticated backend session (queues, console, unauthenticated AJAX) trigger it.","triggerScenarios":"Thrown at modules/backend/models/UserPreference.php:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the code runs within an authenticated backend session before touching preferences","Pass an explicit user object where the API allows it instead of relying on the session","In queued/console contexts, resolve and supply the user id before calling preference methods"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","contentChangedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}