siyuan-note/siyuan · error

requestResult.Msg (cloud server message)

Error message

requestResult.Msg (cloud server message)

What it means

When the cloud ChatGPT proxy returns HTTP 200 but the envelope's Code is non-zero, CloudChatGPT returns errors.New(requestResult.Msg) (kernel/model/cloud_service.go:83) and sets stop=true. requestResult.Msg is the cloud server's own human-readable message (quota exhausted, content policy, upstream AI error), passed through verbatim to the caller.

Solutions

  1. Read the returned error text (it is the server's message) and show it to the user verbatim; stop indicates no fallback content should be used
  2. Check subscription/quota status in Settings - Account if the message mentions limits or trials
  3. Retry later if the message indicates a temporary upstream/server error
  4. In code, treat any error from CloudChatGPT as terminal (stop=true) rather than retrying blindly
Defensive patterns

Strategy: try-catch

Try / catch

reply, stop, err := model.CloudChatGPT(msg, ctx)
if err != nil {
    if stop { ui.showServerError(err.Error()) return } // server message is user-facing
}

Prevention

When it happens

Trigger: Calling CloudChatGPT when the server-side request fails for business reasons: AI quota/subscription exhausted, cloud upstream error, or the account not entitled to the AI service — i.e. Status 200 with a non-zero result code.

Common situations: Free trial ended or paid quota consumed; cloud-side AI provider outage surfaced as a server message; regional restrictions; account flagged or rate-limited by the cloud service.

Related errors


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

Appendix: source

Thrown at kernel/model/cloud_service.go:83

	resp, err := request.
		SetSuccessResult(requestResult).
		SetCookies(&http.Cookie{Name: "symphony", Value: user.UserToken}).
		SetBody(payload).
		Post(util.GetCloudServer() + "/apis/siyuan/ai/chatGPT")
	if err != nil {
		logging.LogErrorf("chat gpt failed: %s", err)
		err = ErrFailedToConnectCloudServer
		return
	}
	if http.StatusUnauthorized == resp.StatusCode {
		invalidUser()
		return "", true, errors.New(Conf.Language(31))
	}
	if http.StatusOK != resp.StatusCode {
		return "", true, ErrFailedToConnectCloudServer
	}
	if 0 != requestResult.Code {
		err = errors.New(requestResult.Msg)
		stop = true
		return
	}

	data := requestResult.Data.(map[string]any)
	choices := data["choices"].([]any)
	if 1 > len(choices) {
		stop = true
		return
	}
	choice := choices[0].(map[string]any)
	message := choice["message"].(map[string]any)
	ret = message["content"].(string)

	if nil != choice["finish_reason"] {
		finishReason := choice["finish_reason"].(string)
		if "length" == finishReason {
			stop = false

View on GitHub (pinned to 9f775e8a12)