{"record":{"id":"d2857db4c100e027","repo":"hashicorp/nomad","slug":"error-inserting-job-summary-v","errorCode":null,"errorMessage":"error inserting job summary: %v","messagePattern":"error inserting job summary: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store.go","lineNumber":5370,"sourceCode":"\t\t\t\tswitch childJob.Status {\n\t\t\t\tcase structs.JobStatusPending:\n\t\t\t\t\tsummary.Children.Pending++\n\t\t\t\tcase structs.JobStatusDead:\n\t\t\t\t\tsummary.Children.Dead++\n\t\t\t\tcase structs.JobStatusRunning:\n\t\t\t\t\tsummary.Children.Running++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Insert the job summary if its different\n\t\t\tif !reflect.DeepEqual(summary, oldSummary) {\n\t\t\t\t// Set the create index of the summary same as the job's create index\n\t\t\t\t// and the modify index to the current index\n\t\t\t\tsummary.CreateIndex = job.CreateIndex\n\t\t\t\tsummary.ModifyIndex = index\n\n\t\t\t\tif err := txn.Insert(\"job_summary\", summary); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error inserting job summary: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Done with handling a parent job, continue to next\n\t\t\tcontinue\n\t\t}\n\n\t\t// Create a job summary for the job\n\t\tsummary := &structs.JobSummary{\n\t\t\tJobID:     job.ID,\n\t\t\tNamespace: job.Namespace,\n\t\t\tSummary:   make(map[string]structs.TaskGroupSummary),\n\t\t}\n\t\tfor _, tg := range job.TaskGroups {\n\t\t\tsummary.Summary[tg.Name] = structs.TaskGroupSummary{}\n\t\t}\n\n\t\t// Find all the allocations for the jobs","sourceCodeStart":5352,"sourceCodeEnd":5388,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store.go#L5352-L5388","documentation":"In upsertJobImpl (parent-job branch, e.g. parameterized/periodic multiregion handling), the store inserts a freshly built JobSummary into the job_summary table; this error wraps a failed txn.Insert(\"job_summary\", summary). The summary tracks allocation counts per task group for the scheduler. The Raft transaction aborts, so the job registration that this belongs to is also rejected.","triggerScenarios":"Job registration/upsert where creating the job summary row for a parent job fails in memdb (summary insert error).","commonSituations":"memdb write failure on the leader; corrupted job_summary table after crash; Nomad version-specific memdb bugs during job registration of periodic/parameterized jobs.","solutions":["Retry the job submit (nomad job run / API) — the atomic abort leaves consistent state for a clean retry","Check server logs for the wrapped inner error to distinguish memdb corruption from logic bugs","Restore server state from a raft snapshot if job registrations repeatedly fail with insert errors","Upgrade Nomad if the inner error matches a known state-store bug in your version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := store.UpsertJob(idx, job)\nif err != nil && strings.Contains(err.Error(), \"error inserting job summary\") {\n\treturn retryWithBackoff(3, time.Second, func() error {\n\t\treturn store.UpsertJob(idx, job)\n\t})\n}","preventionTips":["Retry job registration after backoff — aborted transactions leave consistent state","Watch for a pattern: failures only on periodic/parameterized (parent) jobs points to this code path","Restore from raft snapshot if job_summary inserts fail persistently","Keep the inner error from logs for upstream bug reports"],"tags":["nomad","state-store","job-summary","raft"],"backgroundTag":"state-store-write-failed","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"}