nektos/act · error
bad mode specified: %s
Error message
bad mode specified: %s
What it means
In the three-segment case (host:container:mode), validateLinuxPath runs the third segment through the device-mode validator (a non-empty ordered subset of 'rwm'). If it is not a valid mode, 'bad mode specified' is returned showing the offending mode.
Source
Thrown at pkg/container/docker_cli.go:1129
}
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))
}
case 3:
containerPath = split[1]
mode = split[2]
if isValid := validator(split[2]); !isValid {
return val, fmt.Errorf("bad mode specified: %s", mode)
}
val = fmt.Sprintf("%s:%s:%s", split[0], containerPath, mode)
}
if !path.IsAbs(containerPath) {
return val, fmt.Errorf("%s is not an absolute path", containerPath)
}
return val, nil
}
// validateAttach validates that the specified string is a valid attach option.
func validateAttach(val string) (string, error) {
s := strings.ToLower(val)
if slices.Contains([]string{"stdin", "stdout", "stderr"}, s) {
return s, nil
}
return val, errors.New("valid streams are STDIN, STDOUT and STDERR")
}View on GitHub (pinned to 4f41128141)
Solutions
- Use only the letters r, w, m for the mode, e.g. rwm, rw, or r
- Drop the mode entirely for the default rwm: --device /dev/x:/dev/x
- Do not use ro/rw/chmod octals — they are invalid for devices
Example fix
# before --device /dev/x:/dev/x:ro # after --device /dev/x:/dev/x:r
Defensive patterns
Strategy: validation
Validate before calling
// Go: mirror validDeviceMode
func isValidDeviceMode(m string) bool {
if m == "" { return false }
seen := map[rune]bool{}
for _, r := range m {
if r != 'r' && r != 'w' && r != 'm' { return false }
if seen[r] { return false }
seen[r] = true
}
return true
} Prevention
- Device modes are r/w/m only — not ro, not octal, not mount flags
- Omit the mode segment to get the default rwm
When it happens
Trigger: Passing a mode segment that is empty, contains letters outside r/w/m (e.g. 'rwxa'), or duplicates like 'rr'. Example: --device /dev/x:/dev/x:rox.
Common situations: Assuming chmod-style modes (4, 6, 755) or mount option vocabulary (ro, rw) instead of Docker's rwm device modes.
Related errors
- unknown server OS: %s
- invalid device specification: %s
- bad format for path: %s
- %s is not an absolute path
- --pid: invalid PID mode
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/0d610cab975019bb.
Report an issue: GitHub.