{"record":{"id":"e1fe3db8c0617e2a","repo":"nektos/act","slug":"invalid-value-d-valid-memory-swappiness-range-i","errorCode":null,"errorMessage":"invalid value: %d. Valid memory swappiness range is 0-100","messagePattern":"invalid value: (.+?)\\. Valid memory swappiness range is 0-100","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/container/docker_cli.go","lineNumber":375,"sourceCode":"\tif copts.macAddress != \"\" {\n\t\tif _, err := net.ParseMAC(strings.TrimSpace(copts.macAddress)); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s is not a valid mac address\", copts.macAddress)\n\t\t}\n\t}\n\tif copts.stdin {\n\t\tattachStdin = true\n\t}\n\t// If -a is not set, attach to stdout and stderr\n\tif copts.attach.Len() == 0 {\n\t\tattachStdout = true\n\t\tattachStderr = true\n\t}\n\n\tvar err error\n\n\tswappiness := copts.swappiness\n\tif swappiness != -1 && (swappiness < 0 || swappiness > 100) {\n\t\treturn nil, fmt.Errorf(\"invalid value: %d. Valid memory swappiness range is 0-100\", swappiness)\n\t}\n\n\tvar binds []string\n\tvolumes := copts.volumes.GetMap()\n\t// add any bind targets to the list of container volumes\n\tfor bind := range copts.volumes.GetMap() {\n\t\tparsed, err := loader.ParseVolume(bind)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif parsed.Source != \"\" {\n\t\t\ttoBind := bind\n\n\t\t\tif parsed.Type == string(mount.TypeBind) {\n\t\t\t\tif hostPart, targetPath, ok := strings.Cut(bind, \":\"); ok {\n\t\t\t\t\tif !filepath.IsAbs(hostPart) && strings.HasPrefix(hostPart, \".\") {\n\t\t\t\t\t\tif absHostPart, err := filepath.Abs(hostPart); err == nil {","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/docker_cli.go#L357-L393","documentation":"The memory swappiness option is validated to the kernel's accepted range 0-100. The sentinel -1 means 'not set' and is allowed; any other negative value or anything above 100 fails option parsing immediately. It mirrors docker run's --memory-swappiness semantics.","triggerScenarios":"Passing --memory-swappiness (via job/container options or act's docker flag plumbing) with a value like 101, 150, or -2. The check is swappiness != -1 && (swappiness < 0 || swappiness > 100).","commonSituations":"Copy-pasting tuned sysctl vm.swappiness values (which can exceed 100 on some systems historically) into docker options; transposition typos (1000 instead of 100); assuming docker allows 0-200.","solutions":["Set the value within 0-100 (60 is the usual default)","Drop --memory-swappiness entirely — modern Docker (v20+) has deprecated it anyway","Double-check YAML numeric literals for stray zeros"],"exampleFix":"# before\noptions: --memory-swappiness 150\n\n# after\noptions: --memory-swappiness 60","handlingStrategy":"validation","validationCode":"if swappiness != -1 && (swappiness < 0 || swappiness > 100) {\n    return fmt.Errorf(\"swappiness %d out of range 0-100\", swappiness)\n}","typeGuard":"func isValidSwappiness(v int64) bool { return v == -1 || (v >= 0 && v <= 100) }","tryCatchPattern":null,"preventionTips":["Remember the valid window is 0-100 with -1 as 'unset'","Omit --memory-swappiness on modern Docker; it is deprecated","Validate numeric options in workflow linting"],"tags":["docker","memory","swappiness","validation","act"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}