siyuan-note/siyuan · error

result.Msg (send article to liandi failed [code=%d, msg=%s])

Error message

result.Msg (send article to liandi failed [code=%d, msg=%s])

What it means

After the Liandi send request returns HTTP 200 but the JSON body carries result.Code != 0, the kernel logs the wrapped message and returns errors.New(result.Msg) — the Liandi server's own business-error message is surfaced to the user. The literal 'send article to liandi failed [code=%d, msg=%s]' appears in the log, while the returned error text is result.Msg itself.

Source

Thrown at kernel/model/export.go:515

			resp, sendErr = request.Put(apiURL)
		} else {
			resp, sendErr = request.Post(apiURL)
		}
		if nil != sendErr {
			logging.LogErrorf("send article to liandi failed: %s", sendErr)
			return sendErr
		}
		if 200 != resp.StatusCode {
			msg := fmt.Sprintf("send article to liandi failed [sc=%d]", resp.StatusCode)
			logging.LogError(msg)
			return errors.New(msg)
		}

		if 0 != result.Code {
			msg := fmt.Sprintf("send article to liandi failed [code=%d, msg=%s]", result.Code, result.Msg)
			logging.LogError(msg)
			util.PushClearMsg(msgId)
			return errors.New(result.Msg)
		}

		if !foundArticle {
			articleId = result.Data.(string)
			tree, _ = LoadTreeByBlockID(id) // 这里必须重新加载,因为前面导出时已经修改了树结构
			tree.Root.SetIALAttr(liandiArticleIdAttrName, articleId)
			if err = writeTreeUpsertQueue(tree); err != nil {
				return err
			}
		}

		util.PushMsg(fmt.Sprintf(Conf.Language(181), util.GetCloudAccountServer()+"/article/"+articleId), 7000)
		return nil
	})
	return
}

func ExportSystemLog() (zipPath string) {

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Read the msg text in the error — it comes from the Liandi server and usually names the cause (auth, quota)
  2. Re-authenticate the cloud/Liandi account in SiYuan settings
  3. Wait if it is a quota/rate issue, then retry
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await export2Liandi(blockId);
} catch (e) {
  // e.msg is the Liandi server's business message; surface it verbatim to the user
  showHint(e.msg || e.message);
  if (/token|auth/i.test(e.msg)) promptRelogin();
}

Prevention

When it happens

Trigger: Liandi API returns {code: !=0, msg: ...} for a send/lookup request — e.g. invalid API token, quota exceeded, or article content rejected server-side.

Common situations: Expired Liandi access token, hitting the daily post limit, banned/restricted Liandi account, content flagged by server validation.

Related errors


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