{"record":{"id":"589ca65bcc416cc5","repo":"hashicorp/nomad","slug":"payload-exceeds-maximum-size-d-d","errorCode":null,"errorMessage":"Payload exceeds maximum size; %d > %d","messagePattern":"Payload exceeds maximum size; (.+?) > (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":2143,"sourceCode":"\t}\n\n\treturn nil\n}\n\n// validateDispatchRequest returns whether the request is valid given the\n// parameterized job.\nfunc validateDispatchRequest(req *structs.JobDispatchRequest, job *structs.Job, config *Config) error {\n\t// Check the payload constraint is met\n\thasInputData := len(req.Payload) != 0\n\tif job.ParameterizedJob.Payload == structs.DispatchPayloadRequired && !hasInputData {\n\t\treturn fmt.Errorf(\"Payload is not provided but required by parameterized job\")\n\t} else if job.ParameterizedJob.Payload == structs.DispatchPayloadForbidden && hasInputData {\n\t\treturn fmt.Errorf(\"Payload provided but forbidden by parameterized job\")\n\t}\n\n\t// Check the payload doesn't exceed the size limit\n\tif l := len(req.Payload); l > DispatchPayloadSizeLimit {\n\t\treturn fmt.Errorf(\"Payload exceeds maximum size; %d > %d\", l, DispatchPayloadSizeLimit)\n\t}\n\n\t// Check if the metadata is a set\n\tkeys := make(map[string]struct{}, len(req.Meta))\n\tfor k := range req.Meta {\n\t\tif _, ok := keys[k]; ok {\n\t\t\treturn fmt.Errorf(\"Duplicate key %q in passed metadata\", k)\n\t\t}\n\t\tkeys[k] = struct{}{}\n\t}\n\n\trequired := set.From(job.ParameterizedJob.MetaRequired)\n\toptional := set.From(job.ParameterizedJob.MetaOptional)\n\n\t// Check the metadata key constraints are met\n\tunpermitted := make(map[string]struct{})\n\tfor k := range req.Meta {\n\t\treq := required.Contains(k)","sourceCodeStart":2125,"sourceCodeEnd":2161,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L2125-L2161","documentation":"Dispatch payloads are capped at DispatchPayloadSizeLimit (16 KiB) for performance and Raft entry-size reasons. If the submitted payload exceeds that byte length, the dispatch is rejected with the actual and maximum sizes.","triggerScenarios":"Dispatching with a Payload whose len() exceeds 16384 bytes (e.g. large JSON blobs, files piped via stdin).","commonSituations":"Piping large files into `nomad job dispatch`; serializing big configs into the payload instead of passing an object-store reference; growing payload content over time until it crosses the 16KiB limit.","solutions":["Shrink the payload below 16384 bytes; send a reference (S3/GCS path, artifact URL) instead of the data","Compress the data if feasible, keeping the encoded size under the limit","Move bulk data to external storage and pass only identifiers via meta"],"exampleFix":"// before\ncat big-blob.json | nomad job dispatch batch-process   # 120KB\n// after\nS3_URL=$(upload_to_s3 big-blob.json)\necho \"$S3_URL\" | nomad job dispatch batch-process","handlingStrategy":"validation","validationCode":"const maxPayload = 16384\nif len(payload) > maxPayload {\n    return fmt.Errorf(\"payload is %d bytes; limit is %d\", len(payload), maxPayload)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce a 16KiB budget on dispatch payloads in client code","Pass storage references (S3 URLs) instead of raw data","Add CI checks that generated dispatch payloads stay small"],"tags":["nomad","api","payload","size-limit","validation"],"backgroundTag":"payload-size-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"}