goharbor/harbor · error

found more than one scheduled scan all job, please ensure…

Error message

found more than one scheduled scan all job, please ensure that only one schedule left

What it means

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.

Solutions

  1. List schedules for the scan-all vendor type and delete the extra ones, leaving a single entry
  2. If API deletion is blocked, remove duplicate schedule rows directly in the database (table scheduler) with care
  3. Avoid issuing concurrent CreateScanAllSchedule requests, which can race and produce duplicates
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/server/v2.0/handler/scan_all.go:226 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/0fa48e6fb9b31178. Report an issue: GitHub.

Appendix: source

Thrown at src/server/v2.0/handler/scan_all.go:226

		}
	}

	cbParams := map[string]any{
		// the operator of schedule job is harbor-jobservice
		"operator": secret.JobserviceUser,
	}
	return s.scheduler.Schedule(ctx, job.ScanAllVendorType, 0, cronType, cron, scan.ScanAllCallback, cbParams, nil)
}

func (s *scanAllAPI) getScanAllSchedule(ctx context.Context) (*scheduler.Schedule, error) {
	query := q.New(q.KeyWords{"vendor_type": job.ScanAllVendorType})
	schedules, err := s.scheduler.ListSchedules(ctx, query.First(q.NewSort("creation_time", true)))
	if err != nil {
		return nil, err
	}

	if len(schedules) > 1 {
		return nil, fmt.Errorf("found more than one scheduled scan all job, please ensure that only one schedule left")
	} else if len(schedules) == 0 {
		return nil, nil
	}

	return schedules[0], nil
}

func (s *scanAllAPI) getMetrics(ctx context.Context, trigger ...string) (*models.Stats, error) {
	execution, err := s.getLatestScanAllExecution(ctx, trigger...)
	if err != nil {
		return nil, err
	}

	sts := &models.Stats{}
	if execution != nil {
		if execution.Metrics != nil {
			metrics := execution.Metrics

View on GitHub (pinned to 7b2fd08cc5)