containerd/containerd · error

failed to get info on already active mount: %w

Error message

failed to get info on already active mount: %w

What it means

In the task mount manager's Activate, when registering a mount fails with ErrAlreadyExists (a task with the same ID already holds a mount), containerd tries to fetch the existing activation info via c.manager.Info. If that Info lookup fails, this error wraps it and the mount activation aborts.

Source

Thrown at core/runtime/v2/task_mounts.go:88

	activateOpts := []mount.ActivateOpt{
		mount.WithLabels(map[string]string{
			"containerd.io/gc.bref.container": taskID,
		}),
	}
	activateOpts = append(activateOpts, c.mountClaimOpts(ctx, runtimeName, bootstrap)...)

	ai, err := c.manager.Activate(ctx, taskID, rootfs, activateOpts...)
	switch {
	case err == nil:
		return mountActivation{rootfs: ai.System, owned: true}, nil
	case errdefs.IsAlreadyExists(err):
		// If creation of task with same identifier, use existing mount rather than forcing
		// deactivation of the old one. The back reference will prevent racing between
		// deactivation and re-use, as the container with the same ID would still exist.
		ai, err := c.manager.Info(ctx, taskID)
		if err != nil {
			return mountActivation{}, fmt.Errorf("failed to get info on already active mount: %w", err)
		}
		return mountActivation{rootfs: ai.System}, nil
	case errdefs.IsNotImplemented(err):
		// Nothing needed the mount manager, the shim performs all the mounts.
		return mountActivation{rootfs: rootfs}, nil
	default:
		return mountActivation{}, err
	}
}

// Deactivate deactivates the mounts activated for taskID.
func (c *taskMountController) Deactivate(ctx context.Context, taskID string) error {
	if c.manager == nil {
		return nil
	}
	return c.manager.Deactivate(ctx, taskID)
}

View on GitHub (pinned to 4246446a2b)

Solutions

  1. Remove the stale task/mount state (deactivate or delete the container with the conflicting ID) and retry.
  2. Avoid reusing container IDs until the old one is fully removed.
  3. Inspect the wrapped Info error for the true cause (NotFound => stale reference; cleanup the mount manager state).

Example fix

// before
ctr, err := client.NewContainer(ctx, sameID) // reuse ID while old mount still active
// after
if err := client.ContainerService().Delete(ctx, sameID); err != nil && !errdefs.IsNotFound(err) { return err }
ctr, err := client.NewContainer(ctx, sameID)
Defensive patterns

Strategy: retry

Validate before calling

// Before activating, check for an existing container with the same ID
if _, err := c.manager.Info(ctx, taskID); err == nil {
    return errors.New("task ID already active; choose another ID or delete first")
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "failed to get info on already active mount") {
        // stale/racing mount; cleanup and retry with backoff
        time.Sleep(50 * time.Millisecond)
        return activateMount(ctx, taskID, rootfs)
    }
    return err
}

Prevention

When it happens

Trigger: Activate is called for a task ID that already has an active mount, and the subsequent manager.Info(ctx, taskID) fails (task vanished concurrently, ID mismatch, manager internal error).

Common situations: Race where the previous container/task is being torn down while a new one with the same ID activates; leftover stale mount state from a crashed task; ID reuse without cleanup.

Related errors


AI-assisted analysis of containerd/containerd@4246446a2b (2026-09-02). Data as JSON: /api/errors/38b01c1191738f1a. Report an issue: GitHub.