{"record":{"id":"f52cadd63532b7b7","repo":"hashicorp/nomad","slug":"job-summary-for-job-q-in-namespace-q-is-not-pres","errorCode":null,"errorMessage":"job summary for job %q in namespace %q is not present","messagePattern":"job summary for job %q in namespace %q is not present","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store.go","lineNumber":6073,"sourceCode":"\n\tsummaryRaw, err := txn.First(\"job_summary\", \"id\", alloc.Namespace, alloc.JobID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to lookup job summary for job id %q in namespace %q: %v\", alloc.JobID, alloc.Namespace, err)\n\t}\n\n\tif summaryRaw == nil {\n\t\t// Check if the job is de-registered\n\t\trawJob, err := txn.First(\"jobs\", \"id\", alloc.Namespace, alloc.JobID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to query job: %v\", err)\n\t\t}\n\n\t\t// If the job is de-registered then we skip updating it's summary\n\t\tif rawJob == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"job summary for job %q in namespace %q is not present\", alloc.JobID, alloc.Namespace)\n\t}\n\n\t// Get a copy of the existing summary\n\tjobSummary := summaryRaw.(*structs.JobSummary).Copy()\n\n\t// Not updating the job summary because the allocation doesn't belong to the\n\t// currently registered job\n\tif jobSummary.CreateIndex != alloc.Job.CreateIndex {\n\t\treturn nil\n\t}\n\n\ttgSummary, ok := jobSummary.Summary[alloc.TaskGroup]\n\tif !ok {\n\t\treturn fmt.Errorf(\"unable to find task group in the job summary: %v\", alloc.TaskGroup)\n\t}\n\n\tsummaryChanged := false\n\tif existingAlloc == nil {","sourceCodeStart":6055,"sourceCodeEnd":6091,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store.go#L6055-L6091","documentation":"Raised when an alloc references a job that still exists in the jobs table but has no job_summary row. This is a genuine state inconsistency: registration creates the summary, so a live job without one should not happen (e.g. corrupted or manually manipulated state). Unlike the GC'd job case, it does not return nil — it fails the update.","triggerScenarios":"updateAlloc paths: alloc update arrives for a job whose summary row is absent while txn.First(\"jobs\", ...) confirms the job row exists.","commonSituations":"State store corruption, manual edits to raft snapshots, or version-upgrade/restore bugs where job_summary rows were lost while job rows survived.","solutions":["Verify state consistency: nomad operator raft list-peers / inspect job via API — does GET /v1/job/:id work and show summary data?","Resubmit (re-register) the job with nomad job run to recreate the summary row","If corruption persists, take a fresh server snapshot, rebuild the cluster, and restore"],"exampleFix":"/* before: inconsistent state — job exists, summary lost, alloc updates keep failing */\nnomad status example-job   // summary missing\n\n// after: re-register the job to recreate its JobSummary row\nnomad job run example.nomad.hcl","handlingStrategy":"validation","validationCode":"// before depending on alloc updates, confirm job + summary exist\njob, _, err := client.Jobs().Info(jobID, nil)\nif err != nil {\n    return fmt.Errorf(\"job %q gone or unreadable: %w\", jobID, err)\n}\nsummary, _, err := client.Jobs().Summary(jobID, nil)\nif err != nil || summary == nil {\n    // summary row missing: re-register the job to recreate it\n    _, _, err = client.Jobs().Register(job, nil)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"job summary for job\") {\n    // state inconsistency: recreate the summary by re-registering the job\n    return reRegisterJob(alloc.Namespace, alloc.JobID)\n}","preventionTips":["Never hand-edit raft snapshots or the Nomad data dir","Restore state only via nomad operator snapshot restore","Re-register jobs after any state restore/upgrade","Compare jobs and job_summary tables if you suspect corruption"],"tags":["nomad","state-store","job-summary","corruption"],"backgroundTag":"missing-job-summary-state-inconsistency","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"}