{"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":"Error \"failed to create the schedule: the task status is %s\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/pkg/scheduler/scheduler.go:190 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}