siyuan-note/siyuan · error

Conf.Language(0)

Error message

Conf.Language(0)

What it means

Thrown by createShorthandDocByDOM when Conf.Box(boxID) returns nil, meaning no notebook with the given boxID is registered. Conf.Language(0) is the generic 'Query notebook failed' message. The function is the persistence path for shorthand (闪念速记) documents and aborts before any doc is written.

Source

Thrown at kernel/model/shortcuts.go:283

	luteEngine := util.NewLute()
	luteEngine.SetHTMLTag2TextMark(true)
	_, tree := luteEngine.Md2BlockDOMTree(md, false)
	if nil == tree {
		return ""
	}
	resetBlockIDsByTime(tree.Root, created)
	return luteEngine.Tree2BlockDOM(tree, luteEngine.RenderOptions, luteEngine.ParseOptions)
}

// createShorthandDocByDOM 创建速记文档,使用指定的 DOM 和文档块 ID(均基于速记输入时刻)。
// 速记场景无需 tags、父文档、数学公式、剪藏链接等处理,直接基于 DOM 和指定 docID 落盘。
func createShorthandDocByDOM(boxID, hPath, dom, docID string) (retID string, err error) {
	createDocLock.Lock()
	defer createDocLock.Unlock()

	box := Conf.Box(boxID)
	if nil == box {
		err = errors.New(Conf.Language(0))
		return
	}

	FlushTxQueue()
	retID, err = createDocsByHPath(box.ID, hPath, dom, "", docID, false)
	if nil != err {
		return
	}
	FlushTxQueue()

	bt := treenode.GetBlockTree(retID)
	if nil == bt {
		logging.LogWarnf("get block tree by id [%s] failed after create", retID)
		return
	}
	box.setSortByConf(path.Dir(bt.Path), retID)

	FlushTxQueue()

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Re-open Settings - Quick capture / Shorthand and reselect a valid target notebook so the stored boxID is corrected.
  2. Restart the kernel so the notebook index is rebuilt and the boxID resolves again.
  3. Verify the boxID passed in actually exists via the notebook list before capture (frontend should fall back to a default notebook).

Example fix

// before
box := Conf.Box(boxID) // nil after notebook deleted -> error
// after (defensive caller)
box := Conf.Box(boxID)
if box == nil {
    boxID = defaultShorthandBoxID() // pick a valid fallback
    box = Conf.Box(boxID)
}
Defensive patterns

Strategy: validation

Validate before calling

// Go: confirm the notebook exists before creating the shorthand doc
if Conf.Box(boxID) == nil {
    return "", fmt.Errorf("notebook %s not found, reselect shorthand target", boxID)
}

Type guard

// Go helper
func notebookExists(boxID string) bool { return Conf.Box(boxID) != nil }

Prevention

When it happens

Trigger: The shorthand subsystem (called from shortcuts.go:117 and :185) hands a boxID that does not match any loaded notebook. Triggered when the configured shorthand target notebook was deleted, renamed at the config level, or when the workspace is opened with a different/conf/data set that no longer has that box.

Common situations: User deletes the notebook that was set as the shorthand inbox, then triggers a new shorthand. Sync or workspace switch left Conf.Box() unable to resolve the stored boxID. Mobile flash-capture fires before the notebook index is fully loaded at boot.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/0fb8c27db99082cc. Report an issue: GitHub.