{"record":{"id":"1302ec47c48825d1","repo":"hashicorp/nomad","slug":"task-memory-requirements-exceed-driver-hard-limit","errorCode":null,"errorMessage":"task memory requirements exceed driver hard limit of %d MB","messagePattern":"task memory requirements exceed driver hard limit of (.+?) MB","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/driver.go","lineNumber":1040,"sourceCode":"\timageID string) (createContainerOptions, error) {\n\n\tlogger := d.logger.With(\"task_name\", task.Name)\n\tc := createContainerOptions{}\n\n\t// ensure that PortMap variables are populated early on\n\ttask.Env = taskenv.SetPortMapEnvs(task.Env, driverConfig.PortMap)\n\n\tif task.Resources == nil {\n\t\t// Guard against missing resources. We should never have been able to\n\t\t// schedule a job without specifying this.\n\t\tlogger.Error(\"task.Resources is empty\")\n\t\treturn c, fmt.Errorf(\"task.Resources is empty\")\n\t}\n\n\tmemory, memoryReservation := memoryLimits(driverConfig.MemoryHardLimit,\n\t\ttask.Resources.NomadResources.Memory)\n\tif memory > 0 && memoryReservation > memory {\n\t\treturn c, fmt.Errorf(\"task memory requirements exceed driver hard limit of %d MB\",\n\t\t\tdriverConfig.MemoryHardLimit)\n\t}\n\n\tbinds, err := d.containerBinds(task, driverConfig)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tlogger.Trace(\"binding volumes\", \"volumes\", binds)\n\n\t// create the config block that will later be consumed by go-dockerclient\n\tconfig := &containerapi.Config{\n\t\tImage:      imageID,\n\t\tEntrypoint: driverConfig.Entrypoint,\n\t\tHostname:   driverConfig.Hostname,\n\t\tUser:       task.User,\n\t\tTty:        driverConfig.TTY,\n\t\tOpenStdin:  driverConfig.Interactive,\n\t}","sourceCodeStart":1022,"sourceCodeEnd":1058,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/driver.go#L1022-L1058","documentation":"When the operator sets a driver-level memory_hard_limit in the docker plugin config, the task's requested memory (reservation) must not exceed that limit. If the computed reserved memory is greater than the hard limit (and limit > 0), container creation is rejected so the kernel OOM-killer does not immediately kill the container.","triggerScenarios":"Job requests memory greater than the plugin's memory_hard_limit: e.g. plugin configured memory_hard_limit = 256 while the job's resources.memory = 512, or memory set via memory_limits/Hard MB mismatch.","commonSituations":"Cluster operators tightening memory_hard_limit on existing clients without updating job specs; a job spec copied from another cluster with a higher hard limit; MB vs MiB assumptions making the requested value larger than expected.","solutions":["Raise memory_hard_limit in the Nomad client docker plugin config to at least the task's requested memory.","Lower the job's resources.memory (or memory_hard task field) to fit under the plugin limit.","Target the task at clients where the plugin config permits the requested memory (use a constraint or client block)."],"exampleFix":"// job\n// before\nresources { memory = 512 }\n// plugin has memory_hard_limit = 256\n// after\nresources { memory = 256 }  // or raise plugin memory_hard_limit to 512","handlingStrategy":"validation","validationCode":"function validateMemoryWithinHardLimit(jobMemoryMB, memoryHardLimitMB) {\n  if (memoryHardLimitMB > 0 && jobMemoryMB > memoryHardLimitMB) {\n    throw new Error(`job memory ${jobMemoryMB}MB exceeds driver hard limit ${memoryHardLimitMB}MB`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await client.jobs.submit(job);\n} catch (err) {\n  if (/exceed driver hard limit/.test(err.message)) {\n    console.error('Reduce resources.memory or raise plugin memory_hard_limit');\n  }\n  throw err;\n}","preventionTips":["Keep memory_hard_limit in client config version-controlled next to job specs.","Lint jobs against per-client plugin limits before submission.","Document the cluster's memory_hard_limit in team runbooks."],"tags":["docker","memory","config","nomad"],"backgroundTag":"resource-limit-exceeded","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"}