{"record":{"id":"0fa48e6fb9b31178","repo":"goharbor/harbor","slug":"found-more-than-one-scheduled-scan-all-job-please","errorCode":null,"errorMessage":"found more than one scheduled scan all job, please ensure that only one schedule left","messagePattern":"found more than one scheduled scan all job, please ensure that only one schedule left","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src/server/v2.0/handler/scan_all.go","lineNumber":226,"sourceCode":"\t\t}\n\t}\n\n\tcbParams := map[string]any{\n\t\t// the operator of schedule job is harbor-jobservice\n\t\t\"operator\": secret.JobserviceUser,\n\t}\n\treturn s.scheduler.Schedule(ctx, job.ScanAllVendorType, 0, cronType, cron, scan.ScanAllCallback, cbParams, nil)\n}\n\nfunc (s *scanAllAPI) getScanAllSchedule(ctx context.Context) (*scheduler.Schedule, error) {\n\tquery := q.New(q.KeyWords{\"vendor_type\": job.ScanAllVendorType})\n\tschedules, err := s.scheduler.ListSchedules(ctx, query.First(q.NewSort(\"creation_time\", true)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(schedules) > 1 {\n\t\treturn nil, fmt.Errorf(\"found more than one scheduled scan all job, please ensure that only one schedule left\")\n\t} else if len(schedules) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn schedules[0], nil\n}\n\nfunc (s *scanAllAPI) getMetrics(ctx context.Context, trigger ...string) (*models.Stats, error) {\n\texecution, err := s.getLatestScanAllExecution(ctx, trigger...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsts := &models.Stats{}\n\tif execution != nil {\n\t\tif execution.Metrics != nil {\n\t\t\tmetrics := execution.Metrics\n","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/server/v2.0/handler/scan_all.go#L208-L244","documentation":"Data-integrity guard in getScanAllSchedule: the scheduler returned more than one schedule for the scan-all vendor type. Exactly one scan-all schedule is expected; multiple entries (usually the result of concurrent creation, historical bugs, or direct DB edits) make the schedule ambiguous, so getting, creating, or updating the schedule fails until the duplicates are removed.","triggerScenarios":"Thrown at src/server/v2.0/handler/scan_all.go:226 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["List schedules for the scan-all vendor type and delete the extra ones, leaving a single entry","If API deletion is blocked, remove duplicate schedule rows directly in the database (table scheduler) with care","Avoid issuing concurrent CreateScanAllSchedule requests, which can race and produce duplicates"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","contentChangedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}