hashicorp/nomad · warning

job source size of %s exceeds maximum of %s and will be disc

Error message

job source size of %s exceeds maximum of %s and will be discarded

What it means

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.

Source

Thrown at nomad/job_endpoint_hooks.go:674

func (j *Job) submissionController(args *structs.JobRegisterRequest) error {
	if args.Submission == nil {
		return nil
	}
	maxSize := j.srv.GetConfig().JobMaxSourceSize
	submission := args.Submission
	// discard the submission if the source + variables is larger than the maximum
	// allowable size as set by client config
	totalSize := len(submission.Source)
	totalSize += len(submission.Variables)
	for key, value := range submission.VariableFlags {
		totalSize += len(key)
		totalSize += len(value)
	}
	if totalSize > maxSize {
		args.Submission = nil
		totalSizeHuman := humanize.Bytes(uint64(totalSize))
		maxSizeHuman := humanize.Bytes(uint64(maxSize))
		return fmt.Errorf("job source size of %s exceeds maximum of %s and will be discarded", totalSizeHuman, maxSizeHuman)
	}
	return nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Reduce job source size: split the job, externalize large data (templates, configs) into files or a template backend
  2. Increase the server's job_submission_size limit in server configuration if large sources are legitimate
  3. Accept the warning — the job registers, only the stored source is dropped

Example fix

// before
nomad job run giant-job.hcl // 40KB source -> discarded
// after
# server.hcl
server { job_submission_size = 65536 } // or shrink the HCL
Defensive patterns

Strategy: validation

Validate before calling

// before submit
const maxBytes = 16384 // or server job_submission_size
src, _ := os.ReadFile("job.hcl")
if len(src) > maxBytes {
  return fmt.Errorf("job source %d bytes exceeds %d; source will be discarded", len(src), maxBytes)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/ffcdd006e4a291a8. Report an issue: GitHub.