siyuan-note/siyuan · error
Conf.Language(31)
Error message
Conf.Language(31)
What it means
getBazaarRatingUserToken returns the logged-in user's cloud token; if no user is signed in or the token is empty, it fails with localized message Conf.Language(31) ("please log in to the cloud"). Ratings APIs require an authenticated SiYuan account.
Solutions
- Log in to SiYuan cloud in Settings - Account so Conf.GetUser().UserToken is populated
- If the token was invalidated, sign out and sign in again to refresh it
- For headless/test environments, skip or mock the rating APIs
Defensive patterns
Strategy: try-catch
Validate before calling
const user = await api.getUser(); // or check Conf user state
if (!user || !user.userToken) {
throw new Error("Cloud login required before using marketplace rating APIs");
} Type guard
function isLoggedIn(u) {
return typeof u === "object" && u !== null && typeof u.userToken === "string" && u.userToken.length > 0;
} Try / catch
try {
await api.getBazaarPackageRating(pkgType, packageName);
} catch (e) {
if (isLoginRequiredError(e)) {
openAccountSettings(); // prompt cloud login
} else throw e;
} Prevention
- Sign in to SiYuan cloud before using rating features
- Handle token expiry by re-authenticating instead of retrying blindly
- Skip rating calls in offline/headless environments
When it happens
Trigger: Calling any bazaar rating API (GetBazaarPackageRating, SetBazaarPackageRating, installed ratings, or validateBazaarPackageRatingRequest's token path) while the workspace has no cloud account configured or user.UserToken is empty (not logged in, or login token expired/cleared).
Common situations: Self-hosted or offline instances never signed into SiYuan cloud; token invalidated after password change; automated tests running without cloud login.
Related errors
- Account authentication failed, please login again
- cloud server result message (result.Msg)
- invalid cloud login token
- request bazaar package rating failed
- request bazaar package rating failed: HTTP
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/88056fd916078df2.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/bazaar_rating.go:266
}
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 9f775e8a12)