{"record":{"id":"ffcdd006e4a291a8","repo":"hashicorp/nomad","slug":"job-source-size-of-s-exceeds-maximum-of-s-and-wi","errorCode":null,"errorMessage":"job source size of %s exceeds maximum of %s and will be discarded","messagePattern":"job source size of (.+?) exceeds maximum of (.+?) and will be discarded","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"nomad/job_endpoint_hooks.go","lineNumber":674,"sourceCode":"func (j *Job) submissionController(args *structs.JobRegisterRequest) error {\n\tif args.Submission == nil {\n\t\treturn nil\n\t}\n\tmaxSize := j.srv.GetConfig().JobMaxSourceSize\n\tsubmission := args.Submission\n\t// discard the submission if the source + variables is larger than the maximum\n\t// allowable size as set by client config\n\ttotalSize := len(submission.Source)\n\ttotalSize += len(submission.Variables)\n\tfor key, value := range submission.VariableFlags {\n\t\ttotalSize += len(key)\n\t\ttotalSize += len(value)\n\t}\n\tif totalSize > maxSize {\n\t\targs.Submission = nil\n\t\ttotalSizeHuman := humanize.Bytes(uint64(totalSize))\n\t\tmaxSizeHuman := humanize.Bytes(uint64(maxSize))\n\t\treturn fmt.Errorf(\"job source size of %s exceeds maximum of %s and will be discarded\", totalSizeHuman, maxSizeHuman)\n\t}\n\treturn nil\n}\n","sourceCodeStart":656,"sourceCodeEnd":678,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint_hooks.go#L656-L678","documentation":"Nomad stores a 'job source' (e.g. the original HCL/variables submission) alongside the parsed job, subject to a maximum size (cfg.JobSubmissionSize / JobMaxBytes). When the accumulated submission size exceeds maxSize, submissionController discards args.Submission (the job still registers) and returns this warning with humanized sizes.","triggerScenarios":"Registering a job whose submission payload (sum of submission values' lengths) exceeds the configured max (default 16KiB) — typically a very large HCL file or huge variable map. Raised in submissionController, called from doRegister and the anonymous validate hook.","commonSituations":"Very large job files with heredocs; giant var_files inlined into the submission; default 16KB limit hit by generated jobs; user expects UI 'job source' view but it's empty because the submission was discarded.","solutions":["Reduce job source size: split the job, externalize large data (templates, configs) into files or a template backend","Increase the server's job_submission_size limit in server configuration if large sources are legitimate","Accept the warning — the job registers, only the stored source is dropped"],"exampleFix":"// before\nnomad job run giant-job.hcl // 40KB source -> discarded\n// after\n# server.hcl\nserver { job_submission_size = 65536 } // or shrink the HCL","handlingStrategy":"validation","validationCode":"// before submit\nconst maxBytes = 16384 // or server job_submission_size\nsrc, _ := os.ReadFile(\"job.hcl\")\nif len(src) > maxBytes {\n  return fmt.Errorf(\"job source %d bytes exceeds %d; source will be discarded\", len(src), maxBytes)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep job HCL small; externalize templates and large literals","Raise job_submission_size deliberately if big sources are expected","Check the registration warning for 'exceeds maximum' and alert on it"],"tags":["nomad","job-submission","size-limit","hcl","job-registration"],"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"}