siyuan-note/siyuan · error
opened notebook [ ] not found
Error message
opened notebook [%s] not found
What it means
mountImportedNotebooks mounts each imported notebook id and then looks it up in the open configuration via model.Conf.Box(id). If Mount succeeded but the configuration has no box entry for the id (mount returned without registering, or a race removed it), the import aborts with 'opened notebook [%s] not found'.
Solutions
- Re-run the import; a transient race between Mount and Conf.Box usually resolves on retry.
- Check conf.json / the notebooks list to confirm the id actually exists after import; remove stale ids from the import set.
- Reload the kernel configuration (or restart) so Conf sees the newly mounted notebook, then retry.
- If Mount returns an error or the id refers to a deleted notebook, skip that id instead of treating it as opened.
Example fix
// before
existed, err = model.Mount(id)
if nil != err { return }
box := model.Conf.Box(id)
if nil == box { return nil, fmt.Errorf("opened notebook [%s] not found", id) }
// after
existed, err = model.Mount(id)
if nil != err { return }
if err = model.ReloadBoxes(); err != nil { return }
box := model.Conf.Box(id)
if nil == box { continue // skip stale id instead of failing the whole import } Defensive patterns
Strategy: try-catch
Validate before calling
const box = await getNotebook(id); if (!box) skipId(id) // confirm existence before import claim
Try / catch
try { await runImport(ids) }
catch (e) { if (/opened notebook \[.+\] not found/.test(e.message)) { reloadConf(); retryImport(ids) } else throw e } Prevention
- Avoid importing notebooks whose ids collide with recently removed ones
- Serialize import operations against notebook close/remove
- Reload configuration after Mount before reading Conf.Box
When it happens
Trigger: After an .sy import that creates notebooks: model.Mount(id) succeeds but model.Conf.Box(id) returns nil — the notebook was not registered as an opened box, e.g. because the id is stale or the config write raced.
Common situations: Import archives containing notebooks whose ids collide with removed/closed notebooks; concurrent notebook close/remove while importing; corrupted conf.json missing the box entry.
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
- block [ ] is not a sortable document
- Conf.Language(0)
- Conf.Language(331)
- Conf.Language(373)
- imported notebook [ ] contains encrypted payload without…
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/c36796dd55195000.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/api/import.go:168
if nil == box {
return apicontract.ImportSYAuto.FailureWithData(-1, "opened notebook ["+createdBoxID+"] not found", document)
}
event := util.NewCmdResult("createnotebook", 0, util.PushModeBroadcast)
event.Data = map[string]any{"box": box, "existed": existed}
util.PushEvent(event)
return apicontract.Success(apicontract.AutoImportedNotebook(notebookContract(box)))
}, beginImportUpload[apicontract.ImportAutoData])
func mountImportedNotebooks(ids []string) (ret []*model.Box, err error) {
for _, id := range ids {
var existed bool
existed, err = model.Mount(id)
if nil != err {
return
}
box := model.Conf.Box(id)
if nil == box {
return nil, fmt.Errorf("opened notebook [%s] not found", id)
}
ret = append(ret, box)
event := util.NewCmdResult("createnotebook", 0, util.PushModeBroadcast)
event.Data = map[string]any{"box": box, "existed": existed}
util.PushEvent(event)
}
return
}
var continueImportSY = contractHandler(apicontract.ContinueImportSY, func(c *gin.Context, request apicontract.ContinueImportSYRequest) apicontract.Response[apicontract.ImportDocumentData] {
zipPath, err := claimStagedSYImport(request.Token)
if err != nil {
return apicontract.Failure[apicontract.ImportDocumentData](-1, err.Error())
}
defer os.Remove(zipPath)
if err = model.ImportSY(zipPath, request.Notebook, "/"); err != nil {
return apicontract.Failure[apicontract.ImportDocumentData](-1, err.Error())
}View on GitHub (pinned to 9f775e8a12)