goharbor/harbor · error

failed to get stats of worker pools

Error message

failed to get stats of worker pools

What it means

Stats() returns this error when, after collecting heartbeats from Redis, no worker pool statistics could be assembled — meaning no worker pools are alive or reporting heartbeats, so there is nothing to return.

Solutions

  1. Verify the jobservice workers are running and writing heartbeats to the redis pool
  2. Check the redis namespace/connection settings so heartbeat keys are visible to Stats
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/jobservice/worker/cworker/c_worker.go:320 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/9ed0023a12b48b9a. Report an issue: GitHub.

Appendix: source

Thrown at src/jobservice/worker/cworker/c_worker.go:320

		}

		wPoolStatus := workerPoolStatusHealthy
		if time.Unix(hb.HeartbeatAt, 0).Add(workerPoolDeadTime).Before(time.Now()) {
			wPoolStatus = workerPoolStatusDead
		}
		stat := &worker.StatsData{
			WorkerPoolID: hb.WorkerPoolID,
			StartedAt:    hb.StartedAt,
			HeartbeatAt:  hb.HeartbeatAt,
			JobNames:     hb.JobNames,
			Concurrency:  hb.Concurrency,
			Status:       wPoolStatus,
		}
		stats = append(stats, stat)
	}

	if len(stats) == 0 {
		return nil, errors.New("failed to get stats of worker pools")
	}

	return &worker.Stats{
		Pools: stats,
	}, nil
}

// StopJob will stop the job
func (w *basicWorker) StopJob(jobID string) error {
	if utils.IsEmptyStr(jobID) {
		return errors.New("empty job ID to stop")
	}

	t, err := w.ctl.Track(jobID)
	if err != nil && !errs.IsObjectNotFoundError(err) {
		// For none not found error, directly return
		return err
	}

View on GitHub (pinned to 7b2fd08cc5)