{"record":{"id":"4592efe54371432b","repo":"hashicorp/nomad","slug":"missing-parameterized-job-id","errorCode":null,"errorMessage":"missing parameterized job ID","messagePattern":"missing parameterized job ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":2010,"sourceCode":"\t}\n\tdefer metrics.MeasureSince([]string{\"nomad\", \"job\", \"dispatch\"}, time.Now())\n\n\t// Check for submit-job permissions\n\taclObj, err := j.srv.ResolveACL(args)\n\tif err != nil {\n\t\treturn err\n\t} else if !aclObj.AllowNsOp(args.RequestNamespace(), acl.NamespaceCapabilityDispatchJob) {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\tif ok, err := registrationsAreAllowed(aclObj, j.srv.State()); !ok || err != nil {\n\t\tj.logger.Warn(\"job dispatch is currently disabled for non-management ACL\")\n\t\treturn structs.ErrJobRegistrationDisabled\n\t}\n\n\t// Lookup the parameterized job\n\tif args.JobID == \"\" {\n\t\treturn fmt.Errorf(\"missing parameterized job ID\")\n\t}\n\n\tsnap, err := j.srv.fsm.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\tws := memdb.NewWatchSet()\n\tparameterizedJob, err := snap.JobByID(ws, args.RequestNamespace(), args.JobID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif parameterizedJob == nil {\n\t\treturn fmt.Errorf(\"parameterized job not found\")\n\t}\n\n\tif !parameterizedJob.IsParameterized() {\n\t\treturn fmt.Errorf(\"Specified job %q is not a parameterized job\", args.JobID)\n\t}","sourceCodeStart":1992,"sourceCodeEnd":2028,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L1992-L2028","documentation":"Dispatch is the RPC endpoint that launches a child job (dispatch instance) from a parameterized job. Before looking up the job in state store, it requires args.JobID to be non-empty. An empty JobID means the client submitted a dispatch request without identifying which parameterized job to dispatch, so the server cannot proceed.","triggerScenarios":"Calling the JobDispatch RPC (or `nomad job dispatch ''` / client.Dispatch with JobID set to \"\") without setting the JobID field on structs.JobDispatchRequest.","commonSituations":"Programmatic dispatch where the job ID variable was never populated or was overwritten by an empty result from config/templating; CLI wrappers that fail to forward a positional argument; API clients building the request struct manually and forgetting the ID field.","solutions":["Pass the parameterized job ID in the dispatch request (JobDispatchRequest.JobID)","If using the CLI, supply the job ID as the first argument: `nomad job dispatch <job-id>`","Verify the ID is not lost in templating/config before calling Dispatch"],"exampleFix":"// before\nreq := &structs.JobDispatchRequest{}\n// after\nreq := &structs.JobDispatchRequest{JobID: \"batch-process\"}","handlingStrategy":"validation","validationCode":"if req.JobID == \"\" {\n    return fmt.Errorf(\"dispatch requires a JobID\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set JobID when constructing JobDispatchRequest","For CLI usage, validate the positional argument count before invoking dispatch","Add a startup check that config-derived job IDs are non-empty"],"tags":["nomad","api","missing-parameter","validation"],"backgroundTag":"missing-required-argument","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"}