siyuan-note/siyuan · error
cloud server result message (result.Msg)
Error message
cloud server result message (result.Msg)
What it means
After an HTTP 200 response, requestBazaarPackageRating checks the cloud JSON envelope: if result.Code is non-zero, the cloud server itself rejected the request and the library surfaces result.Msg verbatim as the error. This is a pass-through of a server-side business error, not a transport failure.
Source
Thrown at kernel/model/bazaar_rating.go:362
Post(bazaarRatingCloudServer() + endpoint)
if nil != err {
logging.LogWarnf("request bazaar package rating failed: %s", err)
return ErrFailedToConnectCloudServer
}
if http.StatusUnauthorized == resp.StatusCode {
invalidUser()
return errors.New(Conf.Language(31))
}
if http.StatusTooManyRequests == resp.StatusCode {
return ErrBazaarRatingRateLimited
}
if http.StatusOK != resp.StatusCode {
logging.LogWarnf("request bazaar package rating failed: %d", resp.StatusCode)
return ErrFailedToConnectCloudServer
}
if 0 != result.Code {
if "" != result.Msg {
return errors.New(result.Msg)
}
return errors.New("request bazaar package rating failed")
}
*data = result.Data
return nil
}
func isValidBazaarPackageType(pkgType string) bool {
switch pkgType {
case "plugins", "widgets", "icons", "templates", "themes":
return true
default:
return false
}
}
View on GitHub (pinned to 8641553a1f)
Solutions
- Read result.Msg (the returned error text) — it is the authoritative server explanation; act on it directly
- Verify the package type/name/ID sent matches an existing marketplace package
- Re-check authentication and request payload against the current cloud API contract
- If the message is unclear, retry later or check bazaar server status; the failure is server-side
Example fix
// before
if err := SetBazaarPackageRating(pkg, score); err != nil {
return err
}
// after
if err := SetBazaarPackageRating(pkg, score); err != nil {
return fmt.Errorf("bazaar server rejected rating: %s", err) // server result.Msg
} Defensive patterns
Strategy: try-catch
Validate before calling
// ensure inputs reference real marketplace packages
const known = await bazaarPackageExists(pkgType, pkgName);
if (!known) throw new Error(`unknown package ${pkgName}`); Try / catch
try {
await api.setBazaarPackageRating(pkg, score);
} catch (e) {
showServerError(e.message); // server result.Msg surfaced verbatim
} Prevention
- Display server messages to users instead of swallowing them
- Validate package type/name against the current marketplace listing first
- Keep the kernel updated so the cloud API contract stays in sync
When it happens
Trigger: Calling GetBazaarPackageRating or SetBazaarPackageRating when the cloud API returns {code != 0, msg: "..."} — e.g. package not found on the marketplace, account not allowed to rate, or payload rejected by the server.
Common situations: Rating a package name/version that no longer exists in the marketplace, submitting a rating that violates server rules (e.g. own package, already rated under changed rules), or transient cloud-side validation changes.
Related errors
- request bazaar package rating failed
- requestResult.Msg
- result["msg"].(string)
- get block failed: %s
- get bazaar package failed: %s
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/0ba64f0bf2c84883.
Report an issue: GitHub.