siyuan-note/siyuan · error

failed to connect cloud server

Error message

failed to connect cloud server

What it means

ErrFailedToConnectCloudServer (kernel/model/cloud_service.go:40) is the sentinel returned whenever a request to SiYuan's cloud (bazaar ratings, asset upload, AI chat, free trial, account operations, block reminders) fails at the transport level or comes back with an unexpected non-200 status. Callers log the underlying request error and substitute this sentinel, so the original network cause is only in the log, not in the returned error.

Solutions

  1. Check network connectivity and any proxy settings (system proxy or SiYuan's own proxy config) and retry the operation
  2. Read the kernel log for the preceding 'upload assets failed' / 'request bazaar package rating failed' line to see the true underlying cause
  3. Verify the cloud service is reachable (siyuan cloud status page) and wait out an outage; confirm no firewall blocks *.liuyun.io / ld246.com endpoints
  4. Check for an updated SiYuan version if the cloud API endpoints changed; handle ErrFailedToConnectCloudServer with errors.Is and offer a retry with backoff in calling code

Example fix

// before
count, err := model.UploadAssets(...) // offline; err is opaque sentinel

// after
if errors.Is(err, model.ErrFailedToConnectCloudServer) {
    ui.showMessage("Network unavailable - check your connection or proxy, then retry")
    // schedule retry with backoff
}
Defensive patterns

Strategy: retry

Validate before calling

// Go: check connectivity before cloud calls
if err := quickCloudPing(); err != nil { return err } // fail fast offline

Try / catch

if errors.Is(err, model.ErrFailedToConnectCloudServer) {
    // check kernel log for root cause; retry with exponential backoff
    scheduleRetry(op, backoff)
}

Prevention

When it happens

Trigger: Any cloud-bound HTTP call where reqErr != nil (DNS failure, timeout, TLS error, no network) — e.g. assets.go:1487 upload path, bazaar_rating.go:373 rating fetch — or an HTTP status that is neither 200 nor explicitly handled (401 is mapped to the localized not-logged-in error instead).

Common situations: Working offline or behind a corporate proxy/firewall; siyuan cloud maintenance/outage; stale DNS or blocked liuyun.io/bazaar endpoints in some regions; system clock breaks making TLS fail; using SiYuan without a network while features like AI chat or asset upload still trigger cloud calls.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/cloud_service.go:40

	"fmt"
	"net/http"
	"os"
	"path/filepath"
	"regexp"
	"strconv"
	"strings"
	"time"

	"github.com/88250/gulu"
	"github.com/88250/lute/parse"
	"github.com/siyuan-note/httpclient"
	"github.com/siyuan-note/logging"
	"github.com/siyuan-note/siyuan/kernel/conf"
	"github.com/siyuan-note/siyuan/kernel/task"
	"github.com/siyuan-note/siyuan/kernel/util"
)

var ErrFailedToConnectCloudServer = errors.New("failed to connect cloud server")

func CloudChatGPT(msg string, contextMsgs []string) (ret string, stop bool, err error) {
	user := Conf.GetUser()
	if nil == user {
		return
	}
	invalidUser := cloudAccountAuthFailureHandler(user.UserToken)

	payload := map[string]any{}
	var messages []map[string]any
	for _, contextMsg := range contextMsgs {
		messages = append(messages, map[string]any{
			"role":    "user",
			"content": contextMsg,
		})
	}
	messages = append(messages, map[string]any{
		"role":    "user",

View on GitHub (pinned to 9f775e8a12)