siyuan-note/siyuan · error

Conf.Language(30) + " " + err.Error()

Error message

Conf.Language(30) + " " + err.Error()

What it means

GetCloudSpace wraps getCloudSpace and prefixes any underlying failure with the localized string for i18n key 30 ("Failed to obtain cloud info"). The final error message is "<localized prefix> <underlying error>". The real cause is always in the appended err.Error() — typically network failure, auth expiry, or a cloud API error.

Solutions

  1. Read the full error message after the prefix to identify the underlying cause.
  2. Check network connectivity and proxy/firewall settings for the cloud endpoint.
  3. Log out and back in at Settings - Account & Sync - Account to refresh the token.
  4. Retry later if the cloud service is temporarily unavailable.

Example fix

// before
const resp = await fetchPost('/api/repo/getCloudSpace', {});
// after
const resp = await fetchPost('/api/repo/getCloudSpace', {});
if (resp.code !== 0 && resp.msg.includes('Failed to obtain cloud info')) {
  // inspect resp.msg tail for the underlying cause; check network, re-login
  await fetchPost('/api/account/logout', {});
  // prompt user to log in again
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!navigator.onLine) {
  throw new Error('Cannot get cloud space while offline');
}

Try / catch

try {
  const resp = await fetchPost('/api/repo/getCloudSpace', {});
} catch (e) {
  // message = localized prefix + underlying cause; parse tail after 'Failed to obtain cloud info'
  const cause = e.message.replace(/^.*?Failed to obtain cloud info\s*/, '');
  if (/network|timeout|dial/i.test(cause)) showNetworkHelp();
  else if (/auth|token|login/i.test(cause)) promptRelogin();
}

Prevention

When it happens

Trigger: POST /api/repo/getCloudSpace (opening the cloud storage dialog or checking cloud usage) when the request to the cloud service fails: network outage, expired/invalid session token, subscription issues, or cloud-side 5xx.

Common situations: Offline or behind a proxy/firewall blocking the cloud endpoint; session token expired after long idle; cloud service maintenance; DNS failures on restricted networks.

Related errors


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

Appendix: source

Thrown at kernel/model/repository.go:3261

type Backup struct {
	Size    int64  `json:"size"`
	HSize   string `json:"hSize"`
	Updated string `json:"updated"`
	SaveDir string `json:"saveDir"` // 本地备份数据存放目录路径
}

type Sync struct {
	Size      int64  `json:"size"`
	HSize     string `json:"hSize"`
	Updated   string `json:"updated"`
	CloudName string `json:"cloudName"` // 云端同步数据存放目录名
	SaveDir   string `json:"saveDir"`   // 本地同步数据存放目录路径
}

func GetCloudSpace() (s *Sync, b *Backup, hSize, hAssetSize, hTotalSize, hExchangeSize, hTrafficUploadSize, hTrafficDownloadSize, hTrafficAPIGet, hTrafficAPIPut string, err error) {
	stat, err := getCloudSpace()
	if err != nil {
		err = errors.New(Conf.Language(30) + " " + err.Error())
		return
	}

	syncSize := stat.Sync.Size
	syncUpdated := stat.Sync.Updated
	s = &Sync{
		Size:    syncSize,
		HSize:   "-",
		Updated: syncUpdated,
	}

	backupSize := stat.Backup.Size
	backupUpdated := stat.Backup.Updated
	b = &Backup{
		Size:    backupSize,
		HSize:   "-",
		Updated: backupUpdated,
	}

View on GitHub (pinned to 8641553a1f)