siyuan-note/siyuan · error

Conf.Language(31)

Error message

Conf.Language(31)

What it means

During cloud asset upload (uploadAssets2Cloud), an HTTP 401 response from the cloud server causes err = errors.New(Conf.Language(31)): "Account authentication failed, please log in again in [Settings - Account & Sync - Account]". The server rejected the request because the SiYuan account token/session is missing, expired, or invalid.

Solutions

  1. Log in again via Settings - Account & Sync - Account to refresh the token
  2. Log out and back in to force re-authentication if the token is stale
  3. Check network/proxy setup so the auth endpoints are reachable and not stripping cookies/headers
  4. Retry the upload after re-login; if 401 persists, verify the account subscription status on the cloud side

Example fix

// before
resp, _ := http.Post(uploadURL, ...)
// after (client-side guard)
if !conf.IsLoggedIn() || conf.TokenExpired() {
    return errors.New("please log in to SiYuan account before uploading assets")
}
Defensive patterns

Strategy: try-catch

Validate before calling

if !conf.IsLoggedIn() {
    return errors.New("log in via Settings - Account & Sync - Account before cloud upload")
}

Try / catch

if err != nil && strings.Contains(err.Error(), "Account authentication failed") {
    promptRelogin()
    return
}

Prevention

When it happens

Trigger: Uploading assets to SiYuan cloud when the stored auth token is expired or revoked, the user never logged in, or the server responds 401 to the upload request (checked right after reqErr handling at the top of the response processing).

Common situations: Long-lived sessions where the cloud token expired; logging out on another device invalidating the session; clock skew invalidating tokens; using cloud sync features without an active paid/account session.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/8419684abd10dbc0. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/assets.go:1491

			util.PushUpdateMsg(msgId, msg, 3000)
		}

		requestResult := gulu.Ret.NewResult()
		request := httpclient.NewCloudFileRequest2m()
		resp, reqErr := request.
			SetSuccessResult(requestResult).
			SetFile("file[]", absAsset).
			SetCookies(&http.Cookie{Name: "symphony", Value: uploadToken}).
			SetHeader("meta-type", metaType).
			SetHeader("biz-type", bizType).
			Post(util.GetCloudServer() + "/apis/siyuan/upload?ver=" + util.Ver)
		if nil != reqErr {
			logging.LogErrorf("upload assets failed: %s", reqErr)
			return count, ErrFailedToConnectCloudServer
		}

		if 401 == resp.StatusCode {
			err = errors.New(Conf.Language(31))
			return
		}

		if 0 != requestResult.Code {
			logging.LogErrorf("upload assets failed: %s", requestResult.Msg)
			err = fmt.Errorf(Conf.Language(94), requestResult.Msg)
			return
		}

		absAsset = filepath.ToSlash(absAsset)
		relAsset := absAsset[strings.Index(absAsset, "assets/"):]
		completedUploadAssets = append(completedUploadAssets, relAsset)
		logging.LogInfof("uploaded asset [%s]", relAsset)
		count++
	}

	if !ignorePushMsg {
		util.PushClearMsg(msgId)

View on GitHub (pinned to 9f775e8a12)