{"record":{"id":"e29c82e96dd4fbb1","repo":"nektos/act","slug":"cgroupns-invalid-cgroup-mode","errorCode":null,"errorMessage":"--cgroupns: invalid CGROUP mode","messagePattern":"--cgroupns: invalid CGROUP mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/container/docker_cli.go","lineNumber":542,"sourceCode":"\n\tpidMode := container.PidMode(copts.pidMode)\n\tif !pidMode.Valid() {\n\t\treturn nil, errors.New(\"--pid: invalid PID mode\")\n\t}\n\n\tutsMode := container.UTSMode(copts.utsMode)\n\tif !utsMode.Valid() {\n\t\treturn nil, errors.New(\"--uts: invalid UTS mode\")\n\t}\n\n\tusernsMode := container.UsernsMode(copts.usernsMode)\n\tif !usernsMode.Valid() {\n\t\treturn nil, errors.New(\"--userns: invalid USER mode\")\n\t}\n\n\tcgroupnsMode := container.CgroupnsMode(copts.cgroupnsMode)\n\tif !cgroupnsMode.Valid() {\n\t\treturn nil, errors.New(\"--cgroupns: invalid CGROUP mode\")\n\t}\n\n\trestartPolicy, err := opts.ParseRestartPolicy(copts.restartPolicy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tloggingOpts, err := parseLoggingOpts(copts.loggingDriver, copts.loggingOpts.GetSlice())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsecurityOpts, err := parseSecurityOpts(copts.securityOpt.GetSlice())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsecurityOpts, maskedPaths, readonlyPaths := parseSystemPaths(securityOpts)","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/docker_cli.go#L524-L560","documentation":"Error [84]: godotenv.Unmarshal failed while parsing the Docker image's ENV entries (joined with newlines) into a map. This means the image's ENV contains a line godotenv cannot parse — malformed KEY=VALUE pairs or values with characters that break the dotenv grammar. Rare; it indicates a broken image definition rather than act misuse.","triggerScenarios":"An image whose docker history ENV entries contain unparseable content: e.g. ENV lines with embedded newlines/quotes that don't round-trip, or images built by tools that emit non-datum ENV entries. The join with '\\n' concatenates Config.Env, so any entry not matching KEY=VALUE(footer) syntax fails.","commonSituations":"Custom base images built with unusual ENV quoting; images mutated or hand-crafted; older godotenv versions in act being stricter/looser than expected; extremely long or binary content in ENV values.","solutions":["Inspect the image env: docker image inspect <image> --format '{{.Config.Env}}' and look for odd entries","Rebuild the offending base image with clean ENV KEY=VALUE lines","Use a different/upstream base image tag","Report upstream to act if a well-formed image triggers it — the parser may need relaxing"],"exampleFix":"# before (Dockerfile)\nENV MYVAR=\"line1\nline2\"\n# after\nENV MYVAR=\"line1 line2\"","handlingStrategy":"try-catch","validationCode":"// Validate the image env parses before use\nenv := inspectResult.Config.Env\nif _, err := godotenv.Unmarshal(strings.Join(env, \"\\n\")); err != nil {\n\tlog.Warn(\"image ENV unparseable, skipping merge\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unmarshal image env\") { /* switch base image, continue */ }","preventionTips":["Keep Dockerfile ENV lines simple KEY=VALUE","Test custom base images with 'docker image inspect --format {{.Config.Env}}'","Avoid newlines/odd quoting in ENV values"],"tags":["docker","dotenv","image-env","parsing"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}