siyuan-note/siyuan · error

get liandi article info failed

Error message

get liandi article info failed [sc=%d]

What it means

When exporting a document to Liandi, the kernel first queries the Liandi article API to see whether the article already exists. If the HTTP response status is neither 200 nor 404 (e.g. 401, 403, 500), it aborts with fmt.Errorf("get liandi article info failed [sc=%d]", resp.StatusCode). Only 200 (article exists) and 404 (article not found) are considered valid answers.

Solutions

  1. Re-authenticate with Liandi (re-login so the kernel obtains a fresh token) and retry.
  2. Check the reported status code: 401/403 means credentials, 5xx means server-side — retry later for 5xx.
  3. Verify network/proxy access to the Liandi endpoint (util.GetCloudAccountServer()).
  4. If the article attribute is stale, remove the liandiArticleIdAttrName IAL attribute so a fresh article is created.
Defensive patterns

Strategy: retry

Try / catch

if err != nil && strings.Contains(err.Error(), "get liandi article info failed") {
    // extract sc=N; retry with backoff for 5xx, re-auth for 401/403
    return reauthAndRetry()
}

Prevention

When it happens

Trigger: Calling Export2Liandi for an already-published article (liandi article id attribute present) while the Liandi server returns an unexpected status during the lookup GET — expired/invalid auth token, server error, rate limiting, or connectivity proxies returning 5xx/3xx.

Common situations: Expired Liandi session/token; Liandi server maintenance or 500 errors; corporate proxy intercepting the request; deleted-but-not-404 article states.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/export.go:468

				SetSuccessResult(result).
				SetCookies(&http.Cookie{Name: "symphony", Value: Conf.GetUser().UserToken}).
				Get(util.GetCloudAccountServer() + "/api/v2/article/update/" + articleId)
			if nil != getErr {
				logging.LogErrorf("get liandi article info failed: %s", getErr)
				return getErr
			}

			switch resp.StatusCode {
			case 200:
				if 0 == result.Code {
					foundArticle = true
				} else if 1 == result.Code {
					foundArticle = false
				}
			case 404:
				foundArticle = false
			default:
				return fmt.Errorf("get liandi article info failed [sc=%d]", resp.StatusCode)
			}
		}

		apiURL := util.GetCloudAccountServer() + "/api/v2/article"
		if foundArticle {
			apiURL += "/" + articleId
		}

		title := path.Base(tree.HPath)
		tags := tree.Root.IALAttr("tags")
		content := exportMarkdownContent0(id, tree, util.GetCloudForumAssetsServer()+time.Now().Format("2006/01")+"/siyuan/"+Conf.GetUser().UserId+"/",
			true, false, false,
			".md", 3, 1, 1,
			"#", "#",
			"", "",
			false, false, nil, true, false, nil)
		result := gulu.Ret.NewResult()
		request := httpclient.NewCloudRequest30s()

View on GitHub (pinned to 9f775e8a12)