hashicorp/nomad · error

job ID in payload did not match URL

Error message

job ID in payload did not match URL

What it means

JobScaleRequest.Validate: the scale request URL targets one job ID but the payload body carries a different JobID. The RPC layer rejects the mismatch to prevent scaling the wrong job. (The adjacent namespace check is the analogous guard for the header namespace.)

Solutions

  1. Make the job ID in the request payload match the URL path
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/structs/structs.go:887 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at nomad/structs/structs.go:887

	// If EnforceIndex is set then the job will only be scaled if the passed
	// JobModifyIndex matches the current Jobs index. If the index is zero,
	// EnforceIndex is ignored.
	EnforceIndex   bool
	JobModifyIndex uint64

	WriteRequest
}

// Validate is used to validate the arguments in the request
func (r *JobScaleRequest) Validate() error {
	namespace := r.Target[ScalingTargetNamespace]
	if namespace != "" && namespace != r.RequestNamespace() {
		return NewErrRPCCoded(400, "namespace in payload did not match header")
	}

	jobID := r.Target[ScalingTargetJob]
	if jobID != "" && jobID != r.JobID {
		return fmt.Errorf("job ID in payload did not match URL")
	}

	groupName := r.Target[ScalingTargetGroup]
	if groupName == "" {
		return NewErrRPCCoded(400, "missing task group name for scaling action")
	}

	if r.Count != nil {
		if *r.Count < 0 {
			return NewErrRPCCoded(400, "scaling action count can't be negative")
		}

		if r.Error {
			return NewErrRPCCoded(400, "scaling action should not contain count if error is true")
		}

		truncCount := int(*r.Count)
		if int64(truncCount) != *r.Count {

View on GitHub (pinned to 482b49bf1a)