goharbor/harbor · error

failed to create the schedule: the task status is

Error message

failed to create the schedule: the task status is %s

What it means

Post-submit health check in scheduler.Schedule: after the task manager creates the task record it submits the job to jobservice, and a submit failure is not returned as an error. Schedule therefore re-reads the task; if its status is ErrorStatus it means the job never reached jobservice, so the schedule creation is unwound (the deferred handler stops the task) and this error is returned instead of a valid schedule ID.

Solutions

  1. Check jobservice health/connectivity between core and jobservice and retry the scheduling request
  2. Inspect jobservice logs for the underlying job submission failure
  3. Verify Redis and jobservice queue configuration, since submission typically fails on connection or serialization problems
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/pkg/scheduler/scheduler.go:190 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/e3345f21c7374a58. Report an issue: GitHub.

Appendix: source

Thrown at src/pkg/scheduler/scheduler.go:190

	defer func() {
		if err == nil {
			return
		}
		if err := s.taskMgr.Stop(ctx, taskID); err != nil {
			log.Errorf("failed to stop the task %d: %v", taskID, err)
		}
	}()
	// when task manager creating a task, it creates the task database record first and
	// then submits the job to jobservice. If the submitting failed, it doesn't return
	// any error. So we check the task status to make sure the job is submitted to jobservice
	// successfully here
	task, err := s.taskMgr.Get(ctx, taskID)
	if err != nil {
		return 0, err
	}
	if task.Status == job.ErrorStatus.String() {
		// assign the error to "err" to trigger the defer function to clean up the created task
		err = fmt.Errorf("failed to create the schedule: the task status is %s", job.ErrorStatus.String())
		return 0, err
	}

	return scheduleID, nil
}

func (s *scheduler) UnScheduleByID(ctx context.Context, id int64) error {
	executions, err := s.execMgr.List(ctx, &q.Query{
		Keywords: map[string]any{
			"VendorType": JobNameScheduler,
			"VendorID":   id,
		},
	})
	if err != nil {
		return err
	}
	if len(executions) > 0 {
		executionID := executions[0].ID

View on GitHub (pinned to 7b2fd08cc5)