{"record":{"id":"3d5f6cce01390004","repo":"goharbor/harbor","slug":"not-found-3d5f6c","errorCode":"NOT_FOUND","errorMessage":"no schedule is found","messagePattern":"no schedule is found","errorType":"http","errorClass":"lib/errors.Error","httpStatus":404,"severity":"warning","filePath":"src/controller/jobservice/schedule.go","lineNumber":70,"sourceCode":"\tqueueStatusMgr        queuestatus.Manager\n}\n\n// NewSchedulerCtrl ...\nfunc NewSchedulerCtrl() SchedulerController {\n\treturn &schedulerController{\n\t\tschedulerMgr:          scheduler.New(),\n\t\tjobServiceRedisClient: jm.JobServiceRedisClient,\n\t\tqueueStatusMgr:        queuestatus.Mgr,\n\t}\n}\n\nfunc (s *schedulerController) Get(ctx context.Context, vendorType string) (*scheduler.Schedule, error) {\n\tsch, err := s.schedulerMgr.ListSchedules(ctx, q.New(q.KeyWords{\"VendorType\": vendorType}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(sch) == 0 {\n\t\treturn nil, errors.New(nil).WithCode(errors.NotFoundCode).WithMessage(\"no schedule is found\")\n\t}\n\tif sch[0] == nil {\n\t\treturn nil, errors.New(nil).WithCode(errors.NotFoundCode).WithMessage(\"no schedule is found\")\n\t}\n\treturn sch[0], nil\n}\n\nfunc (s *schedulerController) Create(ctx context.Context, vendorType, cronType, cron, callbackFuncName string,\n\tpolicy any, extrasParam map[string]any) (int64, error) {\n\treturn s.schedulerMgr.Schedule(ctx, vendorType, -1, cronType, cron, callbackFuncName, policy, extrasParam)\n}\n\nfunc (s *schedulerController) Delete(ctx context.Context, vendorType string) error {\n\treturn s.schedulerMgr.UnScheduleByVendor(ctx, vendorType, -1)\n}\n\nfunc (s *schedulerController) List(ctx context.Context, query *q.Query) ([]*scheduler.Schedule, error) {\n\treturn s.schedulerMgr.ListSchedules(ctx, query)","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/jobservice/schedule.go#L52-L88","documentation":"The jobservice schedule controller's Get lists schedules filtered only by the caller-supplied vendorType. If no schedule exists for that vendor (job never scheduled through this API), it returns NOT_FOUND 'no schedule is found' - the expected state before the first Create call for that vendor.","triggerScenarios":"GET on the schedule endpoint for a vendor type (e.g. audit log forwarder, purge jobs) before any schedule was created for it; after the vendor's schedule was deleted.","commonSituations":"Automation reading schedule state before creating it; feature optional and never enabled; schedule removed by cleanup tooling.","solutions":["Create the schedule for the vendor type first (schedulerController.Create with cron spec).","Treat 404 as 'not scheduled' and branch accordingly in the client.","Confirm you are querying the right vendorType string."],"exampleFix":"// before\nsch, err := schedCtl.Get(ctx, vendorType)\n\n// after\nsch, err := schedCtl.Get(ctx, vendorType)\nif liberrors.IsErr(err, liberrors.NotFoundCode) {\n    _, err = schedCtl.Create(ctx, vendorType, scheduler.Hourly, \"0 0 * * * *\", callback, nil, nil)\n}","handlingStrategy":"fallback","validationCode":"sch, err := schedCtl.Get(ctx, vendorType)\nif liberrors.IsErr(err, liberrors.NotFoundCode) {\n    sch = nil // interpret as \"no schedule for this vendor yet\"\n}","typeGuard":null,"tryCatchPattern":"sch, err := s.Get(ctx, vendorType)\nif err != nil {\n    if !liberrors.IsErr(err, liberrors.NotFoundCode) { return nil, err }\n    _, err = s.Create(ctx, vendorType, scheduler.Daily, \"0 0 0 * * *\", cb, nil, nil)\n    if err != nil { return nil, err }\n    sch, err = s.Get(ctx, vendorType)\n}","preventionTips":["Bootstrap optional vendors with create-if-missing logic.","Double-check the vendorType string (exact match required).","Treat 404 as state ('unscheduled'), not as an alert."],"tags":["jobservice","scheduler","not-found","bootstrap"],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}