siyuan-note/siyuan · warning
plugin file watcher is not supported on mobile
Error message
plugin file watcher is not supported on mobile
What it means
errPluginFileWatchUnsupported is returned by addStorageWatch and removeStorageWatch when file-system watching is unavailable — specifically on mobile builds, where the plugin source watcher is compiled out. Callers asking the kernel to watch a plugin storage path for changes get this sentinel error instead of a watcher.
Source
Thrown at kernel/plugin/source_watcher.go:38
"crypto/sha256"
"errors"
"os"
"path/filepath"
"runtime"
"sync"
"time"
"github.com/fsnotify/fsnotify"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
)
const (
pluginSourceReloadDelay = 300 * time.Millisecond
pluginSourcePollInterval = time.Second
)
var errPluginFileWatchUnsupported = errors.New("plugin file watcher is not supported on mobile")
type pluginSourceWatchMode uint8
const (
pluginSourceWatchDisabled pluginSourceWatchMode = iota
pluginSourceWatchEvents
pluginSourceWatchPolling
)
type pluginSourceWatchEntry struct {
path string
signature [sha256.Size]byte
fileState pluginSourceFileState
lastError string
verified bool
generation uint64
timer *time.Timer
}View on GitHub (pinned to 8641553a1f)
Solutions
- Guard watch setup with isPluginFileWatchSupported() (or a build/platform check) and skip silently on mobile.
- Treat this sentinel error as an expected no-op on mobile: catch it and continue without a watcher.
- On desktop, verify the watcher prerequisites (fsnotify support) are met — this error should not occur there.
- If hot-reload is required on mobile, use an alternative refresh mechanism (manual reload / kernel push events) instead of fs watching.
Example fix
// before
if err := p.addStorageWatch(path); err != nil {
return err
}
// after
if err := p.addStorageWatch(path); err != nil {
if errors.Is(err, errPluginFileWatchUnsupported) {
return nil // no fs watching on mobile
}
return err
} Defensive patterns
Strategy: fallback
Validate before calling
// Go
if !isPluginFileWatchSupported() {
// skip watch setup up-front on mobile
} Try / catch
if err := p.addStorageWatch(path); err != nil && !errors.Is(err, errPluginFileWatchUnsupported) {
return err
} Prevention
- Gate watch setup behind isPluginFileWatchSupported() or build tags.
- Treat errPluginFileWatchUnsupported as an expected no-op on mobile.
- Provide a non-fs fallback refresh path for mobile plugins.
When it happens
Trigger: Calling KernelPlugin.addStorageWatch(path) or removeStorageWatch(path) on a mobile (Android/iOS/HarmonyOS) build where isPluginFileWatchSupported() returns false; any kernel path that sets up storage watching while running the gomobile-linked kernel.
Common situations: Plugin relies on storage file hot-reload during development but is being tested on the mobile app; shared code path invoked on mobile after being written for desktop; CI running mobile build targets exercising watch setup.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- fsnotify watcher not initialized
- Plugin ${pluginLabel} returned an invalid action
- Plugin ${pluginLabel} returned invalid input: ${validationEr
- Plugin ${pluginLabel} returned invalid input: ${targetValida
- panic(err)
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/c89b37db339a141a.
Report an issue: GitHub.