Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Handle concurrent document moves during notebook listing

Daniel36020f7edefe
diff --git a/kernel/model/box.go b/kernel/model/box.go
index 4cbb06bb76..2ae1566a54 100644
--- a/kernel/model/box.go
+++ b/kernel/model/box.go
@@ -20,6 +20,7 @@ import (
"bytes"
"errors"
"fmt"
+ "io/fs"
"os"
"path"
"path/filepath"
@@ -361,6 +362,10 @@ func (box *Box) Ls(p string) (ret []*FileInfo, totals int, err error) {
for _, f := range entries {
info, infoErr := f.Info()
if nil != infoErr {
+ // 目录枚举后条目可能被并发移动或删除,此时跳过已失效的条目。
+ if errors.Is(infoErr, fs.ErrNotExist) {
+ continue
+ }
logging.LogErrorf("read file info failed: %s", infoErr)
continue
}