{"record":{"id":"be4bed50c224d825","repo":"hashicorp/nomad","slug":"job-id-in-payload-did-not-match-url","errorCode":null,"errorMessage":"job ID in payload did not match URL","messagePattern":"job ID in payload did not match URL","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":887,"sourceCode":"\t// If EnforceIndex is set then the job will only be scaled if the passed\n\t// JobModifyIndex matches the current Jobs index. If the index is zero,\n\t// EnforceIndex is ignored.\n\tEnforceIndex   bool\n\tJobModifyIndex uint64\n\n\tWriteRequest\n}\n\n// Validate is used to validate the arguments in the request\nfunc (r *JobScaleRequest) Validate() error {\n\tnamespace := r.Target[ScalingTargetNamespace]\n\tif namespace != \"\" && namespace != r.RequestNamespace() {\n\t\treturn NewErrRPCCoded(400, \"namespace in payload did not match header\")\n\t}\n\n\tjobID := r.Target[ScalingTargetJob]\n\tif jobID != \"\" && jobID != r.JobID {\n\t\treturn fmt.Errorf(\"job ID in payload did not match URL\")\n\t}\n\n\tgroupName := r.Target[ScalingTargetGroup]\n\tif groupName == \"\" {\n\t\treturn NewErrRPCCoded(400, \"missing task group name for scaling action\")\n\t}\n\n\tif r.Count != nil {\n\t\tif *r.Count < 0 {\n\t\t\treturn NewErrRPCCoded(400, \"scaling action count can't be negative\")\n\t\t}\n\n\t\tif r.Error {\n\t\t\treturn NewErrRPCCoded(400, \"scaling action should not contain count if error is true\")\n\t\t}\n\n\t\ttruncCount := int(*r.Count)\n\t\tif int64(truncCount) != *r.Count {","sourceCodeStart":869,"sourceCodeEnd":905,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L869-L905","documentation":"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.)","triggerScenarios":"Thrown at nomad/structs/structs.go:887 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the job ID in the request payload match the URL path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}