siyuan-note/siyuan · warning

Conf.Language(298)

Error message

Conf.Language(298)

What it means

StartFreeTrial checks the cloud business result code after an HTTP 200 response: code -2 means the account has already used the free trial, and the function returns the localized 'free trial already used' message Conf.Language(298). It is an expected, user-facing business outcome rather than a fault.

Source

Thrown at kernel/model/cloud_service.go:136

	request := httpclient.NewCloudRequest30s()
	resp, err := request.
		SetSuccessResult(requestResult).
		SetCookies(&http.Cookie{Name: "symphony", Value: user.UserToken}).
		Post(util.GetCloudServer() + "/apis/siyuan/user/startFreeTrial")
	if err != nil {
		logging.LogErrorf("start free trial failed: %s", err)
		return ErrFailedToConnectCloudServer
	}
	if http.StatusUnauthorized == resp.StatusCode {
		invalidUser()
		return errors.New(Conf.Language(31))
	}
	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))
	}
	if 0 != requestResult.Code {
		return errors.New(requestResult.Msg)
	}
	return
}

func DeactivateUser() (err error) {
	release := lockAssetSourceChange()
	defer release()
	if Conf.Sync.Provider == conf.ProviderSiYuan {
		if err = requireCompleteAssetDownloads(); err != nil {
			return
		}
	}
	user := Conf.GetUser()
	if user == nil {
		return errors.New(Conf.Language(31))

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Inform the user the trial was already consumed and offer a paid subscription instead (Settings - Account - Subscribe)
  2. Check the subscription status via the account panel before offering the trial button
  3. Treat code -2 as informational, not an error needing retry — retrying will always return -2

Example fix

// before
err := model.StartFreeTrial()
showMessage(err.Error())
// after
err := model.StartFreeTrial()
if err != nil && err.Error() == Conf.Language(298) {
    openSubscriptionPanel() // trial already used
    return
}
if err != nil { showMessage(err.Error()) }
Defensive patterns

Strategy: fallback

Validate before calling

// check subscription state via the account panel before offering the trial
const trialUsed = window.siyuan.user && window.siyuan.user.trialUsed;

Try / catch

err := model.StartFreeTrial()
if err != nil && err.Error() == Conf.Language(298) {
    openSubscriptionPanel() // offer paid plan; do not retry
}

Prevention

When it happens

Trigger: Calling startFreeTrial with a cloud account whose free trial subscription has already been activated at any point in the past.

Common situations: User previously started the trial (possibly on another device under the same account) and later attempts to start it again; retrying the trial action after an earlier successful attempt that the user forgot.

Related errors


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/eb52de5d6862a679. Report an issue: GitHub.