From c904140b3cfb1f0360cf3eef3733c69b89e734e3 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 16 Jul 2026 09:20:33 +0800 Subject: [PATCH] fix: avoid warning on does-not-exist scan error (fixes #10465) (#10791) We never need to treat these as warnings from a scan. Signed-off-by: Jakob Borg --- lib/scanner/walk.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/scanner/walk.go b/lib/scanner/walk.go index 313cfbb3f..479beeb08 100644 --- a/lib/scanner/walk.go +++ b/lib/scanner/walk.go @@ -267,9 +267,22 @@ func (w *walker) scan(ctx context.Context, toHashChan chan<- protocol.FileInfo, // isWarnableError returns true if err is a kind of error we should warn // about receiving from the folder walk. func isWarnableError(err error) bool { - return err != nil && - !errors.Is(err, fs.SkipDir) && // intentional skip - !errors.Is(err, context.Canceled) // folder restarting + switch { + case err == nil: + return false + case errors.Is(err, fs.SkipDir): + // intentional skip + return false + case errors.Is(err, context.Canceled): + // folder restarting + return false + case fs.IsNotExist(err): + // sudden does-not-exist is fine for deleted files, deleted folder + // root triggers health check error instead + return false + default: + return true + } } func (w *walker) walkAndHashFiles(ctx context.Context, toHashChan chan<- protocol.FileInfo, finishedChan chan<- ScanResult) fs.WalkFunc {