{"record":{"id":"ee29ec05e4bb4e37","repo":"hashicorp/nomad","slug":"job-can-t-be-submitted-with-a-payload-only-dispat","errorCode":null,"errorMessage":"job can't be submitted with a payload, only dispatched","messagePattern":"job can't be submitted with a payload, only dispatched","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint_hooks.go","lineNumber":515,"sourceCode":"\tjobWarnings := job.Warnings()\n\tif jobWarnings != nil {\n\t\tif multi, ok := jobWarnings.(*multierror.Error); ok {\n\t\t\t// Unpack multiple warnings\n\t\t\twarnings = append(warnings, multi.Errors...)\n\t\t} else {\n\t\t\twarnings = append(warnings, jobWarnings)\n\t\t}\n\t}\n\n\t// TODO: Validate the driver configurations. These had to be removed in 0.9\n\t//       to support driver plugins, but see issue: #XXXX for more info.\n\n\tif job.Type == structs.JobTypeCore {\n\t\tmultierror.Append(validationErrors, fmt.Errorf(\"job type cannot be core\"))\n\t}\n\n\tif len(job.Payload) != 0 {\n\t\tmultierror.Append(validationErrors, fmt.Errorf(\"job can't be submitted with a payload, only dispatched\"))\n\t}\n\n\tif job.Priority < structs.JobMinPriority || job.Priority > v.srv.config.JobMaxPriority {\n\t\tmultierror.Append(validationErrors, fmt.Errorf(\"job priority must be between [%d, %d]\", structs.JobMinPriority, v.srv.config.JobMaxPriority))\n\t}\n\n\tokForIdentity := v.isEligibleForMultiIdentity()\n\n\ttotalCount := 0\n\tfor _, tg := range job.TaskGroups {\n\t\ttotalCount += tg.Count\n\n\t\tfor _, s := range tg.Services {\n\t\t\tserviceErrs := v.validateServiceIdentity(\n\t\t\t\ts, fmt.Sprintf(\"task group %s\", tg.Name), okForIdentity)\n\t\t\tmultierror.Append(validationErrors, serviceErrs)\n\t\t}\n","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint_hooks.go#L497-L533","documentation":"Appended by the job validation hook when a submitted job spec carries a non-empty Payload; payloads are injected only by nomad job dispatch on parameterized jobs and cannot be set on register.","triggerScenarios":"Calling the job register/Validate API with a job whose Payload byte slice is non-empty instead of using the /v1/job/<id>/dispatch endpoint.","commonSituations":"Registering a parameterized batch job directly instead of dispatching it; restoring exported job specs that captured a dispatched instance's payload.","solutions":["Submit a payload-free copy of the job spec; use 'nomad job dispatch <job>' to create runs","Strip the Payload field from the JSON before registering","Register the parameterized job once, then dispatch instances with -meta key=value"],"exampleFix":"// before\ncurl -X POST /v1/jobs -d '{\"Job\":{\"Payload\":\"aGVsbG8=\",...}}'\n// after\ncurl -X POST /v1/jobs -d '{\"Job\":{...}}'   # register template\nnomad job dispatch mybatch                  # submit payload via dispatch","handlingStrategy":"validation","validationCode":"if len(job.Payload) != 0 {\n\treturn errors.New(\"register the template without payload; use dispatch API instead\")\n}","typeGuard":"func isDispatchable(job *api.Job) bool { return len(job.Payload) == 0 }","tryCatchPattern":null,"preventionTips":["Use nomad job dispatch for parameterized jobs, never direct register","Strip Payload when exporting/restoring job specs"],"tags":["nomad","dispatch","job-spec","validation"],"backgroundTag":"payload-not-allowed","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"}