{"record":{"id":"dbc26cbf66d3603b","repo":"syncthing/syncthing","slug":"watching-is-not-supported","errorCode":null,"errorMessage":"watching is not supported","messagePattern":"watching is not supported","errorType":"exception","errorClass":"ErrWatchNotSupported","httpStatus":null,"severity":"warning","filePath":"lib/fs/filesystem.go","lineNumber":155,"sourceCode":"func (evType EventType) Merge(other EventType) EventType {\n\treturn evType | other\n}\n\nfunc (evType EventType) String() string {\n\tswitch evType {\n\tcase NonRemove:\n\t\treturn \"non-remove\"\n\tcase Remove:\n\t\treturn \"remove\"\n\tcase Mixed:\n\t\treturn \"mixed\"\n\tdefault:\n\t\tpanic(\"bug: Unknown event type\")\n\t}\n}\n\nvar (\n\tErrWatchNotSupported  = errors.New(\"watching is not supported\")\n\tErrXattrsNotSupported = errors.New(\"extended attributes are not supported on this platform\")\n)\n\n// Equivalents from os package.\n\nconst (\n\tModePerm      = FileMode(os.ModePerm)\n\tModeSetgid    = FileMode(os.ModeSetgid)\n\tModeSetuid    = FileMode(os.ModeSetuid)\n\tModeSticky    = FileMode(os.ModeSticky)\n\tModeSymlink   = FileMode(os.ModeSymlink)\n\tModeType      = FileMode(os.ModeType)\n\tPathSeparator = os.PathSeparator\n\tOptAppend     = os.O_APPEND\n\tOptCreate     = os.O_CREATE\n\tOptExclusive  = os.O_EXCL\n\tOptReadOnly   = os.O_RDONLY\n\tOptReadWrite  = os.O_RDWR","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/syncthing/syncthing/blob/058bcd7334839663cf569501d3ac539034d45cb5/lib/fs/filesystem.go#L137-L173","documentation":"ErrWatchNotSupported (filesystem.go:155) is returned by Watch/StartWatcher implementations that cannot observe filesystem events — e.g. fake/in-memory filesystems used in tests, or platform/FilesystemType combinations without a change-notification backend. It signals a permanent capability gap, not a transient failure.","triggerScenarios":"Calling Watch() on a Filesystem implementation that lacks watcher support (fake fs, certain types on certain platforms); library code assuming every Filesystem can watch.","commonSituations":"Unit tests against fake filesystems; embedded/exotic platforms where inotify/FAM/ReadDirectoryChangesW is unavailable; generic wrapper code that calls Watch on any fs.Filesystem it receives.","solutions":["Fall back to periodic scanning/rescan when watching is unsupported instead of failing","Feature-check the filesystem before enabling watch-dependent logic","For production folders on a platform without watchers, use the type that supports them or accept scanning"],"exampleFix":"// before\nevents, errs, err := fs.Watch(name, ignore)\nif err != nil { return err }\n\n// after\nevents, errs, err := fs.Watch(name, ignore)\nif errors.Is(err, fs.ErrWatchNotSupported) {\n    return startPeriodicRescan(fs, interval)\n}\nif err != nil { return err }","handlingStrategy":"fallback","validationCode":null,"typeGuard":"func canWatch(f fs.Filesystem) error {\n    _, _, err := f.Watch(\".\", nil)\n    if errors.Is(err, fs.ErrWatchNotSupported) { return err }\n    return nil // probe or real support\n}","tryCatchPattern":"events, errs, err := f.Watch(name, ignore)\nif errors.Is(err, fs.ErrWatchNotSupported) {\n    events, errs, err = nil, nil, startPolling(f, name, period)\n}","preventionTips":["Always branch on ErrWatchNotSupported and provide a scanning fallback","In tests, use real temporary basic filesystems when watcher behavior matters"],"tags":["filesystem","watcher","platform","capability"],"backgroundTag":null,"analyzedSha":"058bcd7334839663cf569501d3ac539034d45cb5","analyzedAt":"2026-08-15T07:53:43.174Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}