siyuan-note/siyuan · error

Conf.Language(180)

Error message

Conf.Language(180)

What it means

validateFlashcardBlockIDs checks each block ID destined for flashcard creation against the block tree; Conf.Language(180) is the localized message 'Search content block does not exist'. It is returned when getBlockTree(blockID) returns nil, i.e. the block ID is unknown to the index, so no flashcard can be made for it.

Solutions

  1. Verify each blockID exists via the block tree / SQL query (blocks table) before creating cards
  2. Re-index the notebook if blocks were just created and retry
  3. Remove deleted block IDs from the request
  4. Confirm ID format is a 14+ char SiYuan block ID, not a bookmark or tag name

Example fix

// before
api.post('/api/riff/createDeckWithBlocks', {deckName, blockIDs: selected})
// after
const rows = await api.post('/api/query/sql', {stmt: `SELECT id FROM blocks WHERE id IN (${ids.map(sqlStr).join(',')})`})
const valid = rows.map(r => r.id)
api.post('/api/riff/createDeckWithBlocks', {deckName, blockIDs: valid})
Defensive patterns

Strategy: validation

Validate before calling

const existing = new Set((await api.post('/api/query/sql', {stmt: `SELECT id FROM blocks WHERE id IN (${quoted(ids)})`})).data.map(r => r.id))
const validIDs = ids.filter(id => existing.has(id))

Type guard

const blockExists = (id, known) => known.has(id);

Try / catch

try { await createDeckWithBlocks(ids) } catch (e) { if (e.msg === L(180)) { await reindex(); const v = ids.filter(blockExists); await retry(v) } }

Prevention

When it happens

Trigger: Calling flashcard APIs (e.g. /api/riff/createDeckWithBlocks, ValidateFlashcardBlockIDs) with a blockID that is not in the block tree — deleted block, wrong ID format that never existed, or index not yet built for new content.

Common situations: Client cached an old selection while the block was deleted; passing a static/asset or bookmark anchor string instead of a real block ID; creating cards immediately after import before indexing completes.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/flashcard.go:52

	"github.com/siyuan-note/filelock"
	"github.com/siyuan-note/logging"
	"github.com/siyuan-note/riff"
	"github.com/siyuan-note/siyuan/kernel/cache"
	"github.com/siyuan-note/siyuan/kernel/sql"
	"github.com/siyuan-note/siyuan/kernel/treenode"
	"github.com/siyuan-note/siyuan/kernel/util"
)

// ValidateFlashcardBlockIDs 只允许普通笔记本中可确认存在的块进入全局闪卡存储。
func ValidateFlashcardBlockIDs(blockIDs []string) error {
	return validateFlashcardBlockIDs(blockIDs, treenode.GetBlockTree, IsEncryptedBox)
}

func validateFlashcardBlockIDs(blockIDs []string, getBlockTree func(string) *treenode.BlockTree, isEncryptedBox func(string) bool) error {
	for _, blockID := range blockIDs {
		bt := getBlockTree(blockID)
		if bt == nil {
			return errors.New(Conf.Language(180))
		}
		if isEncryptedBox(bt.BoxID) {
			return errors.New(Conf.Language(393))
		}
	}
	return nil
}

func validateFlashcardTree(rootID string) error {
	return ValidateFlashcardBlockIDs([]string{rootID})
}

func isSupportedFlashcardBlock(blockID string) bool {
	bt := treenode.GetBlockTreeInExactBox(blockID, "")
	return bt != nil && !IsEncryptedBox(bt.BoxID)
}

func filterSupportedFlashcards(cards []riff.Card) (ret []riff.Card) {

View on GitHub (pinned to 9f775e8a12)