siyuan-note/siyuan · error
result.Msg
Error message
result.Msg
What it means
After a successful HTTP 200 from the Liandi article API, the kernel checks the JSON envelope's business Code. If result.Code != 0, the request failed at the application level and the kernel returns errors.New(result.Msg) — i.e. the error message is Liandi's own API message string, passed through verbatim to the caller.
Solutions
- Read the returned msg text — it comes from Liandi and names the concrete application-level problem.
- Re-authenticate with Liandi if the message indicates token/session issues.
- Reduce or sanitize the document content if the message indicates size or content rejection.
- Retry later if the message suggests a transient server-side condition.
Defensive patterns
Strategy: fallback
Try / catch
if err != nil {
// err text is Liandi's result.Msg; show it to the user verbatim
showUserError(err.Error())
return err
} Prevention
- Treat the returned message as authoritative from Liandi and display it
- Check account quota/permissions on Liandi before publishing
- Log result.Code alongside msg for diagnosis
When it happens
Trigger: Calling Export2Liandi when Liandi returns 200 with a non-zero code in the JSON body — e.g. quota exceeded, invalid article content, permission denied on the target account, or duplicate/conflicting article state.
Common situations: Account restrictions or expired Liandi membership; content policy rejection; API contract changes on the Liandi side producing new error messages.
Related errors
- Backup failed
- Conf.Language(204)
- Conf.Language(84), formatRepoErrorMsg(err)
- Conf.Language(94)
- Conf.Language(94) (localized upload failure message with…
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/b518170b82d94d1a.
Report an issue: GitHub.
Appendix: 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 9f775e8a12)