dagger/dagger · error
missing engine locker
Error message
missing engine locker
What it means
After obtaining the query, lockMountedCaches requires the engine's locker (query.Locker()) to serialize cache volume access. If the locker is nil the engine cannot grant cache locks and this error is returned, preventing unsafe concurrent cache writes.
Source
Thrown at core/container_exec.go:571
ActiveRef bkcache.MutableRef
OutputMutable bkcache.MutableRef
OutputImmutable bkcache.ImmutableRef
}
type materializedExecPlan struct {
Root executor.Mount
Mounts []executor.Mount
States []*execMountState
}
func lockMountedCaches(ctx context.Context, mounts []ContainerMount) (func(), error) {
query, err := CurrentQuery(ctx)
if err != nil {
return nil, fmt.Errorf("get current query for cache locks: %w", err)
}
locker := query.Locker()
if locker == nil {
return nil, fmt.Errorf("missing engine locker")
}
lockSet := make(map[string]struct{})
for i, ctrMount := range mounts {
if ctrMount.Readonly || ctrMount.CacheSource == nil || ctrMount.CacheSource.Volume.Self() == nil {
continue
}
cacheSelf := ctrMount.CacheSource.Volume.Self()
if !cacheSharingModeLocksWrites(cacheSelf.Sharing) {
continue
}
lockKey, err := cacheSelf.lockKey()
if err != nil {
return nil, fmt.Errorf("cache lock key for mount %d: %w", i, err)
}
lockSet[lockKey] = struct{}{}
}
if len(lockSet) == 0 {View on GitHub (pinned to 82ba2681db)
Solutions
- Run through a fully initialized dagger engine session where the locker is configured
- Check engine initialization code so Locker() is set on the query
- If the mounts don't need write-locking semantics, mark them readonly or remove the cache mount
Example fix
// before query without locker -> startContainer with cache share SHARED // after initialize engine locker before exec, or set cache sharing to PRIVATE/LOCKED-free readonly mount
Defensive patterns
Strategy: validation
Validate before calling
if q.Locker() == nil { return errors.New("engine locker unavailable") } Type guard
func lockerReady(q *Query) bool { return q.Locker() != nil } Prevention
- Initialize engine locker before running execs
- Mark cache mounts readonly when write locks aren't needed
- Avoid locker-less embedded setups for cache-sharing execs
When it happens
Trigger: Executing a container with writable cache mounts while the engine session has no locker configured (locker-less engine or misinitialized query).
Common situations: Running core exec code outside a fully initialized engine, or engine configurations that skip locker setup (e.g. certain embedded/test setups).
Related errors
- get current query for cache locks: %w
- cache lock key for mount %d: %w
- cache pragma %q, must be a valid string
- get parent name: %w
- get fn name: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/1b7d8ecf175b0ab6.
Report an issue: GitHub.