siyuan-note/siyuan · error
Conf.Language(0)
Error message
Conf.Language(0)
What it means
importSY0 validates the import target before proceeding. When importing into an existing notebook (auto-detected or explicit boxID, no new notebook creation), it looks up the notebook via Conf.Box(boxID); if no notebook with that ID exists in the workspace, it aborts with the localized error message for language key 0 (typically 'Notebook not found'). This guards against importing a .sy package into a non-existent or unloaded notebook.
Solutions
- Verify the boxID: GET /api/notebook/lsNotebooks and confirm the target notebook ID exists in the response.
- If a new notebook should be created from the package, pass createNotebook=true (and a name) instead of a boxID.
- Switch to / open the workspace containing the target notebook, or reopen the closed notebook in the UI so it is loaded.
- Correct the calling client so it sends the notebook ID (a 24-character ID), not the notebook title or path.
Example fix
// before
fetch('/api/import/sy', {body: JSON.stringify({notebook: 'My Notes'})})
// after
fetch('/api/import/sy', {body: JSON.stringify({notebook: '20240101120000-abc1234'})}) // valid boxID from lsNotebooks Defensive patterns
Strategy: validation
Validate before calling
const boxes = await (await fetch('/api/notebook/lsNotebooks', {method:'POST'})).json();
if (!boxes.data.notebooks.some(b => b.id === boxID)) {
throw new Error(`Notebook ${boxID} does not exist; pick an ID from lsNotebooks`);
} Prevention
- Always fetch box IDs from /api/notebook/lsNotebooks instead of hard-coding them
- Pass createNotebook=true when the package should create its own notebook
- Re-fetch the notebook list after switching workspaces before any import
- Check for an empty/undefined boxID before calling the import API
When it happens
Trigger: Calling ImportSY (or ImportSYNotebookBundle, or the /api/import/* endpoints) without createNotebook set and with a boxID that does not match any notebook in the current workspace, or with autoDetect enabled but no valid notebook detected in the import payload and no boxID supplied (that case raises ErrSYTargetNotebookRequired first; a wrong explicit boxID lands here).
Common situations: 1) The boxID was copied from another workspace or an old install where the notebook was deleted. 2) The client passes a notebook name instead of its ID. 3) Workspace was switched and the notebook is not present in the new workspace. 4) The notebook exists on disk but is closed or not yet indexed, so it is absent from Conf's in-memory box list.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/033748a9eaf20a39.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/import.go:521
}
if autoDetect {
if importedMetadataErr != nil {
err = errors.New(Conf.Language(199))
return
}
createNotebook = notebookExport
}
if !createNotebook && len(syPaths) < 1 {
logging.LogErrorf("invalid .sy.zip without documents [unzipRootPath=%s]", unzipRootPath)
err = errors.New(Conf.Language(199))
return
}
if autoDetect && !createNotebook && boxID == "" {
err = ErrSYTargetNotebookRequired
return
}
if !createNotebook && nil == Conf.Box(boxID) {
err = errors.New(Conf.Language(0))
return
}
if createNotebook {
if importedBoxConf != nil && importedBoxConf.Name != "" {
name = importedBoxConf.Name
}
if !precreatedBox {
boxID, err = CreateBox(util.RemoveInvalid(name))
if err != nil {
return "", err
}
}
createdBoxID = boxID
defer func() {
if err == nil {
return
}
treenode.RemoveBlockTreesByBoxID(boxID)View on GitHub (pinned to 9f775e8a12)