{"record":{"id":"c212643a024a0b52","repo":"hashicorp/nomad","slug":"failed-to-parse-ulimit-configuration-v","errorCode":null,"errorMessage":"failed to parse ulimit configuration: %v","messagePattern":"failed to parse ulimit configuration: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/driver.go","lineNumber":1396,"sourceCode":"\thostConfig.UTSMode = containerapi.UTSMode(driverConfig.UTSMode)\n\n\tif usernsErr := d.validateNamespace(d.config.AllowedModes.Userns, \"userns_mode\", driverConfig.UsernsMode); usernsErr != nil {\n\t\treturn c, usernsErr\n\t}\n\thostConfig.UsernsMode = containerapi.UsernsMode(driverConfig.UsernsMode)\n\n\thostConfig.ExtraHosts = driverConfig.ExtraHosts\n\thostConfig.SecurityOpt = driverConfig.SecurityOpt\n\thostConfig.Sysctls = driverConfig.Sysctl\n\n\thostConfig.SecurityOpt, err = parseSecurityOpts(driverConfig.SecurityOpt)\n\tif err != nil {\n\t\treturn c, fmt.Errorf(\"failed to parse security_opt configuration: %v\", err)\n\t}\n\n\tulimits, err := sliceMergeUlimit(driverConfig.Ulimit)\n\tif err != nil {\n\t\treturn c, fmt.Errorf(\"failed to parse ulimit configuration: %v\", err)\n\t}\n\thostConfig.Ulimits = ulimits\n\n\thostConfig.ReadonlyRootfs = driverConfig.ReadonlyRootfs\n\n\t// set the docker network mode\n\thostConfig.NetworkMode = containerapi.NetworkMode(driverConfig.NetworkMode)\n\n\t// if the driver config does not specify a network mode then try to use the\n\t// shared alloc network\n\tif hostConfig.NetworkMode == \"\" {\n\t\tif task.NetworkIsolation != nil && task.NetworkIsolation.Path != \"\" {\n\t\t\t// find the previously created parent container to join networks with\n\t\t\tnetMode := fmt.Sprintf(\"container:%s\", task.NetworkIsolation.Labels[dockerNetSpecLabelKey])\n\t\t\tlogger.Debug(\"configuring network mode for task group\", \"network_mode\", netMode)\n\t\t\thostConfig.NetworkMode = containerapi.NetworkMode(netMode)\n\t\t} else {\n\t\t\t// docker default","sourceCodeStart":1378,"sourceCodeEnd":1414,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/driver.go#L1378-L1414","documentation":"The ulimit option is parsed by sliceMergeUlimit, which expects entries of the form name=soft:hard (or name=soft). Malformed entries, unknown limit names, or values that fail integer parsing cause this wrapped error before any Docker API call.","triggerScenarios":"StartTask -> createContainerConfig calls sliceMergeUlimit(driverConfig.Ulimit) and any ulimit string lacks '=', has a non-integer soft/hard value, or uses an invalid range (soft > hard is accepted by Docker but parsing errors are not).","commonSituations":"Writing 'ulimit { nofile = 65536 }' (map syntax) instead of the expected list entries like \"nofile=65536:65536\"; omitting the '=' or the colon separator; typos in the limit name.","solutions":["Write each ulimit as name=soft:hard, e.g. ulimit = [\"nofile=65536:65536\"]","Check for missing '=' or ':' and non-numeric values in every entry","Refer to Docker's --ulimit documentation for valid names and syntax"],"exampleFix":"// before\ndriver {\n  docker {\n    ulimit = [\"nofile 65536\"]\n  }\n}\n// after\ndriver {\n  docker {\n    ulimit = [\"nofile=65536:65536\"]\n  }\n}","handlingStrategy":"validation","validationCode":"re := regexp.MustCompile(`^[a-zA-Z]+=(\\d+)?(:\\d+)?$`)\nfor _, u := range cfg.Ulimit {\n  if !re.MatchString(u) {\n    return fmt.Errorf(\"ulimit must be name=soft:hard, got %q\", u)\n  }\n}","typeGuard":null,"tryCatchPattern":"err := client.StartTask(task); if err != nil && strings.Contains(err.Error(), \"failed to parse ulimit\") { logOffendingUlimits(cfg.Ulimit) }","preventionTips":["Write ulimits as name=soft:hard list entries","Never use map-style HCL syntax for ulimit","Check values are numeric"],"tags":["docker","nomad-driver","ulimit","config-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}