siyuan-note/siyuan · error

requestResult.Msg

Error message

requestResult.Msg

What it means

This is the cloud server's application-level error message (requestResult.Msg) passed through verbatim. When the useActivationcode endpoint responds HTTP 200 but with a non-zero result Code, the kernel surfaces the server-provided message describing why the activation code was rejected.

Solutions

  1. Read the returned message — it states the server's specific rejection reason (invalid code, already used, etc.)
  2. Double-check the activation code for typos or truncation when copying
  3. If the code was already redeemed, use the account it was applied to or contact SiYuan support with the code and order details
  4. Check the account's subscription status on ld246.com to confirm whether redemption already took effect

Example fix

// caller-side surfacing of the server message
const res = await fetchSyncPost("/api/attr/useActivationcode", {code});
if (res.msg && res.code !== 0) { showMessage(res.msg, 6000); return; } // show e.g. "activation code already used"
Defensive patterns

Strategy: try-catch

Try / catch

const res = await fetchSyncPost("/api/attr/useActivationcode", {code});
if (res.code !== 0) {
  // res.msg is the cloud server's reason (invalid/already-used/expired code)
  showMessage(res.msg || "Activation failed", 6000);
  return;
}
showMessage("Activation successful");

Prevention

When it happens

Trigger: Calling model.UseActivationcode(code) where the cloud responds 200 but requestResult.Code != 0 (kernel/model/cloud_service.go:772) — the code is invalid, already redeemed, expired, belongs to another account type, or the account already has an active subscription.

Common situations: Redeeming a code that was already used on this or another account; typo in the code; code expired per vendor terms; trying to redeem a subscription code on an account that already has an active subscription.

Related errors


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

Appendix: source

Thrown at kernel/model/cloud_service.go:772

	resp, err := request.
		SetSuccessResult(requestResult).
		SetBody(map[string]string{"data": code}).
		SetCookies(&http.Cookie{Name: "symphony", Value: user.UserToken}).
		Post(util.GetCloudServer() + "/apis/siyuan/useActivationcode")
	if err != nil {
		logging.LogErrorf("check activation code failed: %s", err)
		return ErrFailedToConnectCloudServer
	}
	if http.StatusUnauthorized == resp.StatusCode {
		invalidUser()
		return errors.New(Conf.Language(31))
	}
	if http.StatusOK != resp.StatusCode {
		logging.LogErrorf("check activation code failed: %d", resp.StatusCode)
		return ErrFailedToConnectCloudServer
	}
	if 0 != requestResult.Code {
		return errors.New(requestResult.Msg)
	}
	return
}

func CheckActivationcode(code string) (retCode int, msg string) {
	code = util.RemoveInvalid(code)
	code = strings.TrimSpace(code)
	if "" == code {
		retCode = 1
		msg = Conf.Language(294)
		return
	}
	retCode = 1
	user := Conf.GetUser()
	if user == nil {
		return retCode, Conf.Language(31)
	}
	invalidUser := cloudAccountAuthFailureHandler(user.UserToken)

View on GitHub (pinned to 9f775e8a12)