{"record":{"id":"8be01e71d9122e92","repo":"siyuan-note/siyuan","slug":"conf-language-239-8be01e","errorCode":null,"errorMessage":"Conf.language(239)","messagePattern":"Conf\\.language\\(239\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/model/mount.go","lineNumber":272,"sourceCode":"\nfunc collectBoxDeletedAttributeViewBlocks(boxID string) (ret map[string]map[string]struct{}, err error) {\n\trootIDs := treenode.GetRootBlockIDsByBoxID(boxID)\n\tif 1 > len(rootIDs) {\n\t\treturn map[string]map[string]struct{}{}, nil\n\t}\n\tboundAVIDs, err := sql.QueryBoundBlockAVIDsInBox(nil, rootIDs, boxID)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\treturn groupDeletedAttributeViewBlocks(boundAVIDs), nil\n}\n\nfunc RemoveBox(boxID string) (err error) {\n\tif !ast.IsNodeIDPattern(boxID) {\n\t\treturn errors.New(\"invalid notebook ID\")\n\t}\n\tif _, loaded := boxLock.LoadOrStore(boxID, true); loaded {\n\t\terr = errors.New(Conf.language(239))\n\t\treturn\n\t}\n\tdefer boxLock.Delete(boxID)\n\n\tif util.IsReservedFilename(boxID) {\n\t\treturn fmt.Errorf(\"can not remove [%s] caused by it is a reserved file\", boxID)\n\t}\n\n\tFlushTxQueue()\n\tsql.FlushQueue()\n\t// 索引和笔记本目录删除后无法再读取 custom-avs，需提前收集；实际删除成功后再清理绑定行。\n\tdeletedAttrViewBlockIDs, err := collectBoxDeletedAttributeViewBlocks(boxID)\n\tif nil != err {\n\t\treturn fmt.Errorf(\"query database-bound blocks in notebook [%s] failed: %w\", boxID, err)\n\t}\n\tisUserGuide := IsUserGuide(boxID)\n\tlocalPath := filepath.Join(util.DataDir, boxID)\n\tif !filelock.IsExist(localPath) {","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/mount.go#L254-L290","documentation":"RemoveBox uses a per-notebook lock (boxLock sync.Map). If the same boxID is already being removed (LoadOrStore returns loaded=true), it fails fast with localized message Conf.language(239) — the standard 'operation in progress / notebook is busy' user-facing message — instead of running a second concurrent removal. It is a concurrency guard, not a data error.","triggerScenarios":"Two concurrent calls to /api/notebook/removeNotebook for the same notebook ID, e.g. a double-clicked UI action, a plugin script racing a manual removal, or Unmount/notebookRemove/closeUserGuide firing while another removal of the same box is still in flight.","commonSituations":"Automation scripts retrying a slow removal without waiting for the first request to finish; frontend firing the remove request twice on unstable network with a retry wrapper; plugins listening to notebook events and reacting to the removal with the same removal call.","solutions":["Wait for the first removal to finish; check /api/notebook/lsNotebooks to confirm the notebook is gone before retrying","Serialize removal calls client-side: keep only one in-flight request per notebook ID","If the lock appears permanently stuck, restart the kernel — boxLock is in-memory and cleared on restart","Catch this error in the caller and treat it as 'already being removed' rather than retrying immediately"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// track in-flight removals client-side\nconst inFlight = new Set()\nfunction canRemove(boxID) { return !inFlight.has(boxID) }","typeGuard":null,"tryCatchPattern":"if err := removeNotebook(boxID); err != nil {\n    if err.Error() == Conf.language(239) { // already locked / in progress\n        // treat as benign: another removal is running; poll lsNotebooks instead of retrying\n        return nil\n    }\n    return err\n}","preventionTips":["Deduplicate removal requests per notebook ID in the UI/plugin layer","Disable the remove button while a removal request is in flight","Avoid aggressive auto-retry wrappers around notebook mutations"],"tags":["concurrency","notebook","lock-contention","api"],"backgroundTag":"conflicting-operation-in-progress","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}