nektos/act · error

conflicting options: cannot specify both --link and per-netw

Error message

conflicting options: cannot specify both --link and per-network links

What it means

Error [94]: copyContent builds an in-memory tar of small FileEntry payloads (e.g. action configs like action.yml metadata written into the container) and CopyToContainer to dstPath failed. Same daemon-level causes as other copy failures but payload is tiny, so failures usually mean the container/daemon state is broken rather than payload size.

Source

Thrown at pkg/container/docker_cli.go:823

			if ep == nil || reflect.ValueOf(*ep).IsZero() {
				continue
			}
		}
		endpoints[n.Target] = ep
	}
	if hasUserDefined && hasNonUserDefined {
		return nil, errors.New("conflicting options: cannot attach both user-defined and non-user-defined network-modes")
	}
	return endpoints, nil
}

func applyContainerOptions(n *opts.NetworkAttachmentOpts, copts *containerOptions) error { //nolint:gocyclo
	// TODO should we error if _any_ advanced option is used? (i.e. forbid to combine advanced notation with the "old" flags (`--network-alias`, `--link`, `--ip`, `--ip6`)?
	if len(n.Aliases) > 0 && copts.aliases.Len() > 0 {
		return errors.New("conflicting options: cannot specify both --network-alias and per-network alias")
	}
	if len(n.Links) > 0 && copts.links.Len() > 0 {
		return errors.New("conflicting options: cannot specify both --link and per-network links")
	}
	if n.IPv4Address.IsValid() && copts.ipv4Address != nil {
		return errors.New("conflicting options: cannot specify both --ip and per-network IPv4 address")
	}
	if n.IPv6Address.IsValid() && copts.ipv6Address != nil {
		return errors.New("conflicting options: cannot specify both --ip6 and per-network IPv6 address")
	}
	if n.MacAddress != "" && copts.macAddress != "" {
		return errors.New("conflicting options: cannot specify both --mac-address and per-network MAC address")
	}
	if len(n.LinkLocalIPs) > 0 && copts.linkLocalIPs.Len() > 0 {
		return errors.New("conflicting options: cannot specify both --link-local-ip and per-network link-local IP addresses")
	}
	if copts.aliases.Len() > 0 {
		n.Aliases = make([]string, copts.aliases.Len())
		copy(n.Aliases, copts.aliases.GetSlice())
	}
	// For a user-defined network, "--link" is an endpoint option, it creates an alias. But,

View on GitHub (pinned to 4f41128141)

Solutions

  1. Look upward in the log — an earlier error (container start/crash) is the real cause; fix that first
  2. docker ps -a --filter name=act; remove dead containers and re-run
  3. docker logs <container> to see why it exited if it died early
  4. Restart dockerd if 'docker info' itself misbehaves

Example fix

# before: run again on top of broken state
$ act -j job
# after: clean slate
$ docker rm -f $(docker ps -aq --filter name=act-); act -j job
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure container alive before small copies
if c, _ := cli.ContainerInspect(ctx, id); !c.State.Running { return errors.New("container not running") }

Try / catch

if err != nil && strings.Contains(err.Error(), "failed to copy content to container") {
	// small payload => almost always dead container/daemon: check docker ps -a and earlier errors first
}

Prevention

When it happens

Trigger: cr.cli.CopyToContainer of the small buffer failing: container not running anymore, dstPath invalid (e.g. contains '..'), readonly layer, or daemon connection lost.

Common situations: Happens alongside earlier failures: job container crashed at startup so every subsequent copy/exec fails; interrupted previous run left containers in Dead state; mismatched container id after daemon restart.

Related errors


AI-assisted analysis of nektos/act@4f41128141 (2026-08-15). Data as JSON: /api/errors/a10b743b2078073f. Report an issue: GitHub.