siyuan-note/siyuan · error
Account authentication failed, please login again
Error message
Account authentication failed, please login again
What it means
In StartFreeTrial, returned immediately when Conf.GetUser() returns nil, i.e. no user is currently logged in. Conf.Language(31) resolves to 'Account authentication failed, please login again'. This is a precondition guard before any network call, so it fires before the request is even built.
Source
Thrown at kernel/model/cloud_service.go:104
message := choice["message"].(map[string]any)
ret = message["content"].(string)
if nil != choice["finish_reason"] {
finishReason := choice["finish_reason"].(string)
if "length" == finishReason {
stop = false
} else {
stop = true
}
} else {
stop = true
}
return
}
func StartFreeTrial() (err error) {
if nil == Conf.GetUser() {
return errors.New(Conf.Language(31))
}
requestResult := gulu.Ret.NewResult()
request := httpclient.NewCloudRequest30s()
resp, err := request.
SetSuccessResult(requestResult).
SetCookies(&http.Cookie{Name: "symphony", Value: Conf.GetUser().UserToken}).
Post(util.GetCloudServer() + "/apis/siyuan/user/startFreeTrial")
if err != nil {
logging.LogErrorf("start free trial failed: %s", err)
return ErrFailedToConnectCloudServer
}
if http.StatusOK != resp.StatusCode {
logging.LogErrorf("start free trial failed: %d", resp.StatusCode)
return ErrFailedToConnectCloudServer
}
if -2 == requestResult.Code { // 已经试用订阅过
return errors.New(Conf.Language(298))View on GitHub (pinned to 251596fc0d)
Solutions
- Prompt the user to sign in before exposing the 'start free trial' action.
- Guard the UI: disable the trial button when no user is logged in.
- After login, reload Conf so Conf.GetUser() returns a valid user before retrying.
Example fix
// before
err := StartFreeTrial()
// after
if Conf.GetUser() == nil {
promptLogin()
return
}
err := StartFreeTrial() Defensive patterns
Strategy: validation
Validate before calling
// Guard the trial action on an authenticated user
if model.Conf.GetUser() == nil {
promptLogin()
return
} Type guard
func isUserLoggedIn() bool { return model.Conf.GetUser() != nil } Try / catch
if err := model.StartFreeTrial(); err != nil {
if isAuthError(err) { routeToLogin() } else { showError(err) }
} Prevention
- Disable the 'start free trial' control until the user is signed in.
- Check Conf.GetUser() before any subscription-related cloud call.
- Refresh login state on app start to avoid stale nil user.
When it happens
Trigger: The StartFreeTrial API is invoked while the local account state has no authenticated user (user never logged in, logged out, or session was cleared). Because Conf.GetUser() is nil, the function returns before constructing the HTTP request.
Common situations: User opened the trial dialog without signing in; a previous logout cleared Conf user state; fresh install with no account; the user account object failed to load from configuration.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- You have already used a free trial subscription. Duplicate t
- failed to connect cloud server
- requestResult.Msg
- result["msg"].(string)
- Conf.Language(30) {err.Error()}
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/870a05bb90c76238.
Report an issue: GitHub.