siyuan-note/siyuan · error

Conf.Language(0)

Error message

Conf.Language(0)

What it means

In getAssetAbsPath, the doc-level assets search begins with ListNotebooks(); if listing notebooks fails, the function aborts with Conf.Language(0) ("Query notebook failed"). The error means the notebook inventory itself could not be read, not that the asset is missing.

Solutions

  1. Check kernel logs for the underlying ListNotebooks failure and fix the reported notebook/data issue
  2. Verify read permissions on <workspace>/data and each notebook directory
  3. Restart the kernel so notebooks are re-scanned; remove or repair broken notebook folders
  4. If the workspace was restored from backup, ensure notebook .siyuan config files are intact

Example fix

// before
abs, err := model.GetAssetAbsPathWithOpt(rel, false)
// after (diagnose root cause)
if _, nbErr := model.ListNotebooks(); nbErr != nil {
    return fmt.Errorf("notebook listing broken, fix workspace first: %w", nbErr)
}
abs, err := model.GetAssetAbsPathWithOpt(rel, false)
Defensive patterns

Strategy: retry

Validate before calling

if _, err := model.ListNotebooks(); err != nil {
    return fmt.Errorf("fix notebook listing before resolving assets: %w", err)
}

Try / catch

abs, err := model.GetAssetAbsPath(rel)
if err != nil && strings.Contains(err.Error(), "Query notebook failed") {
    // check kernel logs for the underlying notebook scan error
    return restartKernelAndRetry()
}

Prevention

When it happens

Trigger: getAssetAbsPath (via GetAssetAbsPathWithOpt) reaches the per-notebook search for a relativePath starting with 'assets/' and ListNotebooks() returns an error — e.g. the data directory is unreadable, a notebook config (.siyuan/conf.json) is corrupt, or an I/O error occurs while scanning notebooks.

Common situations: Corrupted workspace data directory; file-permission problems after restoring a workspace as another user; a broken notebook folder that breaks notebook enumeration; disk I/O errors on external drives.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/assets.go:1317

			if rootEvalErr != nil {
				return "", fmt.Errorf("resolve assets root [%s] failed: %w", assetsRoot, rootEvalErr)
			}
			if !gulu.File.IsSubPath(realAssetsRoot, realP) {
				return "", fmt.Errorf("symlink [%s] resolves outside data/assets: [%s]", p, realP)
			}
			// 安全校验使用解析后的路径,返回原路径以便下游与 DataDir 保持同一路径形式
			return p, nil
		}
		return p, nil
	}

	// 在文档同级 assets 文件夹下搜索
	if !strings.HasPrefix(relativePath, "assets/") {
		return "", nil
	}
	notebooks, err := ListNotebooks()
	if err != nil {
		return "", errors.New(Conf.Language(0))
	}
	for _, notebook := range notebooks {
		if !includeEncrypted && IsEncryptedBox(notebook.ID) {
			continue // 加密笔记本的资源不参与全局路径解析(孤岛,资源不跨边界)
		}
		notebookAbsPath := filepath.Join(util.DataDir, notebook.ID)
		filelock.Walk(notebookAbsPath, func(path string, d fs.DirEntry, err error) error {
			if isSkipFile(d.Name()) {
				if d.IsDir() {
					return filepath.SkipDir
				}
				return nil
			}
			if p := filepath.ToSlash(path); strings.HasSuffix(p, relativePath) {
				if gulu.File.IsExist(path) {
					absPath = path
					return fs.SkipAll
				}

View on GitHub (pinned to 9f775e8a12)