{"record":{"id":"e3345f21c7374a58","repo":"goharbor/harbor","slug":"failed-to-create-the-schedule-the-task-status-is","errorCode":null,"errorMessage":"failed to create the schedule: the task status is %s","messagePattern":"failed to create the schedule: the task status is (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/pkg/scheduler/scheduler.go","lineNumber":190,"sourceCode":"\tdefer func() {\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tif err := s.taskMgr.Stop(ctx, taskID); err != nil {\n\t\t\tlog.Errorf(\"failed to stop the task %d: %v\", taskID, err)\n\t\t}\n\t}()\n\t// when task manager creating a task, it creates the task database record first and\n\t// then submits the job to jobservice. If the submitting failed, it doesn't return\n\t// any error. So we check the task status to make sure the job is submitted to jobservice\n\t// successfully here\n\ttask, err := s.taskMgr.Get(ctx, taskID)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif task.Status == job.ErrorStatus.String() {\n\t\t// assign the error to \"err\" to trigger the defer function to clean up the created task\n\t\terr = fmt.Errorf(\"failed to create the schedule: the task status is %s\", job.ErrorStatus.String())\n\t\treturn 0, err\n\t}\n\n\treturn scheduleID, nil\n}\n\nfunc (s *scheduler) UnScheduleByID(ctx context.Context, id int64) error {\n\texecutions, err := s.execMgr.List(ctx, &q.Query{\n\t\tKeywords: map[string]any{\n\t\t\t\"VendorType\": JobNameScheduler,\n\t\t\t\"VendorID\":   id,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(executions) > 0 {\n\t\texecutionID := executions[0].ID","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/pkg/scheduler/scheduler.go#L172-L208","documentation":"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.","triggerScenarios":"Thrown at src/pkg/scheduler/scheduler.go:190 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check jobservice health/connectivity between core and jobservice and retry the scheduling request","Inspect jobservice logs for the underlying job submission failure","Verify Redis and jobservice queue configuration, since submission typically fails on connection or serialization problems"],"exampleFix":null,"handlingStrategy":"retry","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"}