siyuan-note/siyuan · warning

localized please-sign-in message (Conf.Language(31))

Error message

localized please-sign-in message (Conf.Language(31))

What it means

getBazaarRatingUserToken requires a signed-in cloud account: if Conf.GetUser() returns nil or the user token is empty, it returns the localized 'please sign in' message (Conf.Language(31)). It is the gate for all cloud rating operations, since every rating API call must carry a user token.

Source

Thrown at kernel/model/bazaar_rating.go:254

	}
	if !installed {
		return "", errors.New("marketplace package is not installed")
	}

	exists, err := bazaar.HasBazaarPackage(ctx, pkgType, packageName)
	if nil != err {
		return "", err
	}
	if !exists {
		return "", errors.New("official marketplace package not found")
	}
	return token, nil
}

func getBazaarRatingUserToken() (string, error) {
	user := Conf.GetUser()
	if nil == user || "" == user.UserToken {
		return "", errors.New(Conf.Language(31))
	}
	return user.UserToken, nil
}

func getInstalledOfficialBazaarPackageNames(ctx context.Context, pkgType string,
	packageNames []string) ([]string, error) {
	if !isValidBazaarPackageType(pkgType) {
		return nil, errors.New("invalid package type")
	}
	installedInfos, _, _, err := bazaarRatingInstalledPackageInfos(pkgType)
	if nil != err {
		return nil, err
	}
	installed := make(map[string]bool, len(installedInfos))
	for _, info := range installedInfos {
		if "" == info.Pkg.InvalidReason {
			installed[info.Pkg.Name] = true
		}

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Sign in to a SiYuan account in the UI (Settings - Account) so Conf carries a non-empty UserToken, then retry
  2. Catch this error in UI code and prompt the user to sign in (it is already user-localized via Conf.Language(31))
  3. If the user is signed in but this still fires, the token may have been invalidated server-side (HTTP 401 path clears it) — re-authenticate
Defensive patterns

Strategy: try-catch

Validate before calling

user := Conf.GetUser()
signedIn := user != nil && user.UserToken != ""

Try / catch

_, _, _, err := model.SetBazaarPackageRating(ctx, pkgType, name, rating)
if err != nil && err.Error() == Conf.Language(31) {
    showDialog("请先登录云端账户") // or match on the localized sign-in message
    return
}

Prevention

When it happens

Trigger: Calling GetBazaarPackageRating, SetBazaarPackageRating, or GetInstalledBazaarPackageUserRatings while no cloud account is configured, the user is logged out, or the stored token is empty; also returned by requestBazaarPackageRating on HTTP 401 when the token has been revoked.

Common situations: Fresh SiYuan installation with no SiYuan account; user signed out of cloud sync; expired/revoked token cleared after an auth failure; headless/API usage of rating endpoints without configuring an account.

Related errors


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