nektos/act · error
conflicting options: cannot specify both --restart and --rm
Error message
conflicting options: cannot specify both --restart and --rm
What it means
Error [91]: The main CopyToContainer of the tar stream to destPath failed in copyTarStream. This is the actual content upload (after the mkdir step succeeded). Wrapped daemon errors include ENOSPC, permission denied on the destination path, container exiting mid-copy, or stream interruption.
Source
Thrown at pkg/container/docker_cli.go:723
SecurityOpt: securityOpts,
StorageOpt: storageOpts,
ReadonlyRootfs: copts.readonlyRootfs,
LogConfig: container.LogConfig{Type: copts.loggingDriver, Config: loggingOpts},
VolumeDriver: copts.volumeDriver,
Isolation: container.Isolation(copts.isolation),
ShmSize: copts.shmSize.Value(),
Resources: resources,
Tmpfs: tmpfs,
Sysctls: copts.sysctls.GetAll(),
Runtime: copts.runtime,
Mounts: copts.mounts.Value(),
MaskedPaths: maskedPaths,
ReadonlyPaths: readonlyPaths,
Annotations: copts.annotations.GetAll(),
}
if copts.autoRemove && !hostConfig.RestartPolicy.IsNone() {
return nil, errors.New("conflicting options: cannot specify both --restart and --rm")
}
// only set this value if the user provided the flag, else it should default to nil
if flags.Changed("init") {
hostConfig.Init = &copts.init
}
// When allocating stdin in attached mode, close stdin at client disconnect
if config.OpenStdin && config.AttachStdin {
config.StdinOnce = true
}
epCfg, err := parseNetworkOpts(copts)
if err != nil {
return nil, err
}
return &containerConfig{View on GitHub (pinned to 4f41128141)
Solutions
- Check the wrapped message: 'no space left' -> prune images/volumes, 'permission denied' -> align UIDs
- Run docker exec -it <c> id to see the copy user vs. destPath ownership
- Prune docker: docker system prune, then retry large copies
- If destPath is on a mounted volume, fix the volume's permissions/mount options
Example fix
# before: dest owned by root, container user 1000 $ docker exec c ls -ld /home/user # after $ docker exec -u 0 c chown -R 1000:1000 /home/user
Defensive patterns
Strategy: try-catch
Validate before calling
// Check space + dest permissions inside container pre-copy
_, _ = cli.ContainerExecCreate(ctx, id, client.ExecCreateOptions{Cmd: []string{"sh", "-c", "test -w " + dest + " && df -k ."}}) Try / catch
if err != nil && strings.Contains(err.Error(), "failed to copy content to container") {
if strings.Contains(err.Error(), "no space left") { /* prune */ } else if strings.Contains(err.Error(), "permission denied") { /* chown dest */ }
} Prevention
- Align container UID/GID with destination ownership
- Prune images/volumes before artifact-heavy jobs
- Avoid copying into read-only mounted volumes
When it happens
Trigger: cr.cli.CopyToContainer(DestinationPath: destPath, tarStream) failing: disk full in the container layer, destPath owned by another UID and exec user lacks write permission, container stops during upload, or connection reset.
Common situations: Copying the workspace into containers running as non-root (UID mismatch vs. the chown step that runs after and silently ignores errors); large workspaces timing out; container disk quotas on CI runners; destination inside a read-only volume.
Related errors
- conflicting options: cannot specify both --network-alias and
- --health-start-interval cannot be negative
- conflicting options: cannot specify both --link and per-netw
- failed to list containers: %w
- --pid: invalid PID mode
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/d62391eee6e32119.
Report an issue: GitHub.