caddyserver/caddy · error
failed to acquire storage lock: %v
Error message
failed to acquire storage lock: %v
What it means
Error "failed to acquire storage lock: %v" thrown in caddyserver/caddy.
Source
Thrown at modules/caddytls/distributedstek/distributedstek.go:153
err := gob.NewEncoder(&buf).Encode(dstek)
if err != nil {
return fmt.Errorf("encoding STEK gob: %v", err)
}
err = s.storage.Store(s.ctx, stekFileName, buf.Bytes())
if err != nil {
return fmt.Errorf("storing STEK gob: %v", err)
}
return nil
}
// getSTEK locks and loads the current STEK from storage. If none
// currently exists, a new STEK is created and persisted. If the
// current STEK is outdated (NextRotation time is in the past),
// then it is rotated and persisted. The resulting STEK is returned.
func (s *Provider) getSTEK() (distributedSTEK, error) {
err := s.storage.Lock(s.ctx, stekLockName)
if err != nil {
return distributedSTEK{}, fmt.Errorf("failed to acquire storage lock: %v", err)
}
//nolint:errcheck
defer s.storage.Unlock(s.ctx, stekLockName)
// load the current STEKs from storage
dstek, err := s.loadSTEK()
if errors.Is(err, fs.ErrNotExist) {
// if there is none, then make some right away
dstek, err = s.rotateKeys(dstek)
if err != nil {
return dstek, fmt.Errorf("creating new STEK: %v", err)
}
} else if err != nil {
// some other error, that's a problem
return dstek, fmt.Errorf("loading STEK: %v", err)
} else if time.Now().After(dstek.NextRotation) {
// if current STEKs are outdated, rotate themView on GitHub (pinned to 50e54ee279)
Solutions
- Check storage backend availability and permissions; another process may hold the lock or the storage may be unreachable.
When it happens
Trigger: Thrown at modules/caddytls/distributedstek/distributedstek.go:153 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/fcbc04dd83d27d9f.
Report an issue: GitHub.