goharbor/harbor · error
there are more than one task with the same job ID
Error message
there are more than one task with the same job ID
What it means
Data-consistency error from jobmonitor stopJob: the task-manager query for job_id returned more than one task. Job IDs are expected to map to exactly one task; multiple matches indicate duplicated task rows and make it unsafe to stop the job.
Solutions
- Inspect the task table for rows sharing the job_id and remove/fix duplicates.
- Investigate why task creation duplicated the job ID (retry logic, race).
- Re-run the stop after cleaning the data.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/controller/jobmonitor/monitor.go:164 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/7c8bc6095307f3fc.
Report an issue: GitHub.
Appendix: source
Thrown at src/controller/jobmonitor/monitor.go:164
log.Errorf("failed to stop running job %s: %v", jobID, err)
return err
}
}
return nil
}
func (w *monitorController) stopJob(ctx context.Context, jobID string) error {
tasks, err := w.taskManager.List(ctx, &q.Query{Keywords: q.KeyWords{"job_id": jobID}})
if err != nil {
return err
}
if len(tasks) == 0 {
// the job is not found
log.Infof("job %s not found, maybe the job is already complete", jobID)
return nil
}
if len(tasks) != 1 {
return fmt.Errorf("there are more than one task with the same job ID")
}
// use local transaction to avoid rollback batch success tasks to previous state when one fail
if ctx == nil {
log.Debug("context is nil, skip stop operation")
return nil
}
return orm.WithTransaction(func(ctx context.Context) error {
return w.taskManager.Stop(ctx, tasks[0].ID)
})(orm.SetTransactionOpNameToContext(ctx, "tx-stop-job"))
}
func (w *monitorController) allRunningJobs(ctx context.Context) ([]string, error) {
jobIDs := make([]string, 0)
wks, err := w.ListWorkers(ctx, all)
if err != nil {
log.Errorf("failed to list workers: %v", err)
return nil, err
}View on GitHub (pinned to 7b2fd08cc5)