juicedata/juicefs · error
read lock file %s: %w
Error message
read lock file %s: %w
What it means
Reported by diskCache.createLockFile when the existing .lock file in the cache directory cannot be read to recover the cache instance id. An I/O error (not a missing file) means the lock state is unreadable and the cache dir is treated as problematic.
Source
Thrown at pkg/chunk/disk_cache.go:200
logger.Infof("Adjusted max items based on freeratio: from %d to %s items", limit, maxItems)
}
}
func (cache *diskCache) lockFilePath() string {
return filepath.Join(cache.dir, ".lock")
}
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() {View on GitHub (pinned to c9a67b23e8)
Solutions
- Fix disk/permission issues on the cache directory
- Delete the unreadable .lock file to let the cache regenerate its id
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/chunk/disk_cache.go:200 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/a9c390007747402a.
Report an issue: GitHub.