nektos/act · warning
failed to remove container: %w
Error message
failed to remove container: %w
What it means
containerReference.remove force-removes the job container with RemoveVolumes+Force at cleanup time. The error is deliberately only logged (logger.Error), not returned — cleanup continues and remove returns nil — so this message appears in logs but does not fail the run.
Source
Thrown at pkg/container/docker_run.go:345
cr.id = ""
return nil
}
}
func (cr *containerReference) remove() common.Executor {
return func(ctx context.Context) error {
if cr.id == "" {
return nil
}
logger := common.Logger(ctx)
_, err := cr.cli.ContainerRemove(ctx, cr.id, client.ContainerRemoveOptions{
RemoveVolumes: true,
Force: true,
})
if err != nil {
logger.Error(fmt.Errorf("failed to remove container: %w", err))
}
logger.Debugf("Removed container: %v", cr.id)
cr.id = ""
return nil
}
}
func (cr *containerReference) mergeContainerConfigs(ctx context.Context, config *container.Config, hostConfig *container.HostConfig) (*container.Config, *container.HostConfig, error) {
logger := common.Logger(ctx)
input := cr.input
if input.Options == "" {
return config, hostConfig, nil
}
// parse configuration from CLI container.options
flags := pflag.NewFlagSet("container_flags", pflag.ContinueOnError)View on GitHub (pinned to 4f41128141)
Solutions
- Treat it as a warning: it does not fail the job — check whether the run result matters
- docker ps -a | grep act- to find leftovers, then docker rm -f them or docker container prune
- If it recurs, investigate daemon health/storage (docker system df, dmesg for overlay errors)
- Avoid running multiple act instances that reuse identical container names
Defensive patterns
Strategy: try-catch
Validate before calling
# shell: clean leftovers before a run
docker ps -a --format '{{.Names}}' | grep '^act-' | xargs -r docker rm -f Try / catch
// Note: remove() already swallows the error internally (logs only, returns nil).
// If calling the API directly, mirror that:
if _, err := cli.ContainerRemove(ctx, id, client.ContainerRemoveOptions{RemoveVolumes: true, Force: true}); err != nil {
log.Warnf("container remove failed (continuing): %w", err)
} Prevention
- Treat this as log noise unless containers accumulate
- Prune stale act- containers periodically
- Avoid concurrent act runs sharing container names
When it happens
Trigger: ContainerRemove failing during cleanup: container already gone (race with a previous cleanup), daemon unreachable at teardown, or a container stuck in a state that even Force cannot remove.
Common situations: Concurrent act runs or interrupted runs where the container vanished; Docker daemon shut down before the job's finally block ran; overlayfs/network in a bad state on the host.
Related errors
- --pid: invalid PID mode
- --uts: invalid UTS mode
- --userns: invalid USER mode
- --cgroupns: invalid CGROUP mode
- --no-healthcheck conflicts with --health-* options
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/e3d888db685d2393.
Report an issue: GitHub.