nektos/act · error

--pid: invalid PID mode

Error message

--pid: invalid PID mode

What it means

Error [81]: Thrown in containerReference.create when the Docker daemon supports image platform selection and input.Platform is set, but the platform string does not split on '/' into exactly two parts (os/arch). Act builds a specs.Platform{OS, Architecture} from the value; anything without exactly one slash (e.g. 'linux', 'amd64', 'linux/amd64/v2') is rejected.

Source

Thrown at pkg/container/docker_cli.go:527

		}
		deviceMappings = append(deviceMappings, deviceMapping)
	}

	// collect all the environment variables for the container
	envVariables, err := opts.ReadKVEnvStrings(copts.envFile.GetSlice(), copts.env.GetSlice())
	if err != nil {
		return nil, err
	}

	// collect all the labels for the container
	labels, err := opts.ReadKVStrings(copts.labelsFile.GetSlice(), copts.labels.GetSlice())
	if err != nil {
		return nil, err
	}

	pidMode := container.PidMode(copts.pidMode)
	if !pidMode.Valid() {
		return nil, errors.New("--pid: invalid PID mode")
	}

	utsMode := container.UTSMode(copts.utsMode)
	if !utsMode.Valid() {
		return nil, errors.New("--uts: invalid UTS mode")
	}

	usernsMode := container.UsernsMode(copts.usernsMode)
	if !usernsMode.Valid() {
		return nil, errors.New("--userns: invalid USER mode")
	}

	cgroupnsMode := container.CgroupnsMode(copts.cgroupnsMode)
	if !cgroupnsMode.Valid() {
		return nil, errors.New("--cgroupns: invalid CGROUP mode")
	}

	restartPolicy, err := opts.ParseRestartPolicy(copts.restartPolicy)

View on GitHub (pinned to 4f41128141)

Solutions

  1. Use the exact os/arch form: --platform linux/amd64 or --platform linux/arm64
  2. For 3-part platforms, drop the variant: linux/amd64/v2 -> linux/amd64
  3. If emulating ARM, also install/qemu binfmt on the host (docker run --privileged --rm tonistiigi/binfmt --install all) so the platform actually pulls
  4. Check spelling: values are case-sensitive lowercase by convention (linux, amd64, arm64, windows)

Example fix

# before
act -P amd64
# after
act -P linux/amd64
Defensive patterns

Strategy: validation

Validate before calling

func validPlatform(p string) error {
	parts := strings.SplitN(p, "/", 2)
	if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
		return fmt.Errorf("platform must be os/arch, got %q", p)
	}
	if strings.Count(p, "/") > 2 { // linux/amd64/v2 also rejected
		return fmt.Errorf("variant not supported, use %s/%s", parts[0], parts[1])
	}
	return nil
}

Type guard

func isOSArchPlatform(p string) bool {
	i := strings.IndexByte(p, '/')
	return i > 0 && i < len(p)-1 && strings.Count(p, "/") == 1
}

Prevention

When it happens

Trigger: Calling act with --platform linux (no arch), --platform amd64 (no os), or a three-part platform like linux/amd64/v2; only when the daemon supports container image platform (supportsContainerImagePlatform) so the parse path is active.

Common situations: Using --platform values copied from docker pull output or a Dockerfile FROM --platform=linux/amd64/v2 tag; assuming a default arch so passing only 'linux'; older/newer Docker daemons differing in platform support, making the flag silently ignored on one machine and fatal on another.

Related errors


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