juicedata/juicefs · error
write lock file %s: %w
Error message
write lock file %s: %w
What it means
Reported by diskCache.createLockFile when a new cache instance UUID cannot be persisted to the empty .lock file. The cache id would change across restarts, so the directory is marked problematic rather than silently reused.
Source
Thrown at pkg/chunk/disk_cache.go:208
func (cache *diskCache) createLockFile() {
lockfile := cache.lockFilePath()
err := cache.checkErr(func() error {
f, err := os.OpenFile(lockfile, os.O_CREATE|os.O_RDWR, 0666)
if err != nil {
return fmt.Errorf("open lock file %s: %w", lockfile, err)
}
defer f.Close()
rawId, err := io.ReadAll(f)
if err != nil {
return fmt.Errorf("read lock file %s: %w", lockfile, err)
}
if len(rawId) > 0 {
cache.id = string(rawId)
} else {
cache.id = uuid.New().String()
_, err = f.Write([]byte(cache.id))
if err != nil {
return fmt.Errorf("write lock file %s: %w", lockfile, err)
}
}
return nil
})
if err != nil {
logger.Warnf("create lock file %s: %s", lockfile, err)
}
}
func (cache *diskCache) checkLockFile() {
lockfile := cache.lockFilePath()
for cache.available() {
time.Sleep(time.Second * 10)
if err := cache.statFile(lockfile); err != nil && os.IsNotExist(err) {
logger.Infof("lockfile %s is lost, cache device maybe broken", lockfile)
if inRootVolume(cache.dir) && cache.freeRatio < 0.2 {
logger.Infof("cache directory %s is in root volume, keep 20%% space free", cache.dir)
cache.freeRatio = 0.2View on GitHub (pinned to c9a67b23e8)
Solutions
- Ensure the cache directory is writable and the filesystem is healthy
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/chunk/disk_cache.go:208 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/8283ea875548edaa.
Report an issue: GitHub.