nektos/act · error

bad format for path: %s

Error message

bad format for path: %s

What it means

validateLinuxPath enforces the [host-dir:]container-path[:mode] form for device paths on Linux daemons. The first check rejects any value containing more than two colons, since at most three colon-separated segments are meaningful.

Source

Thrown at pkg/container/docker_cli.go:1105

		// Windows does validation entirely server-side
		return val, nil
	}
	return "", fmt.Errorf("unknown server OS: %s", serverOS)
}

// validateLinuxPath is the implementation of validateDevice knowing that the
// target server operating system is a Linux daemon.
// It will make sure 'val' is in the form:
//
//	[host-dir:]container-path[:mode]
//
// It also validates the device mode.
func validateLinuxPath(val string, validator func(string) bool) (string, error) {
	var containerPath string
	var mode string

	if strings.Count(val, ":") > 2 {
		return val, fmt.Errorf("bad format for path: %s", val)
	}

	split := strings.SplitN(val, ":", 3)
	if split[0] == "" {
		return val, fmt.Errorf("bad format for path: %s", val)
	}
	switch len(split) {
	case 1:
		containerPath = split[0]
		val = path.Clean(containerPath)
	case 2:
		if isValid := validator(split[1]); isValid {
			containerPath = split[0]
			mode = split[1]
			val = fmt.Sprintf("%s:%s", path.Clean(containerPath), mode)
		} else {
			containerPath = split[1]
			val = fmt.Sprintf("%s:%s", split[0], path.Clean(containerPath))

View on GitHub (pinned to 4f41128141)

Solutions

  1. Reduce the value to at most host:container:mode (two colons)
  2. Use POSIX device paths on Linux daemons
  3. Pass repeated --device flags for multiple devices

Example fix

# before
--device /dev/x:/dev/x:rwm:

# after
--device /dev/x:/dev/x:rwm
Defensive patterns

Strategy: validation

Validate before calling

// Go
if strings.Count(deviceVal, ":") > 2 { return fmt.Errorf("too many colons in %q", deviceVal) }

Prevention

When it happens

Trigger: Passing a --device value with three or more colons, e.g. /dev/a:/dev/b:rwm:extra, or embedding a colon-bearing Windows path on a Linux daemon.

Common situations: Extra colons from typos, pasted Windows drive letters (C:\...), or gluing mode and another field together.

Related errors


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