{"record":{"id":"e8d3e4adab3fb18e","repo":"chenhg5/cc-connect","slug":"errcronprojectnotfound","errorCode":"ErrCronProjectNotFound","errorMessage":"%w: %q","messagePattern":"%w: %q","errorType":"exception","errorClass":null,"httpStatus":404,"severity":"error","filePath":"core/cron.go","lineNumber":673,"sourceCode":"\tjob := cs.store.Get(jobID)\n\tif job == nil {\n\t\treturn\n\t}\n\tcs.runJob(job, false)\n}\n\n// RunJobNow triggers a persisted cron job immediately in the background.\n// Disabled jobs are allowed to run manually; only scheduled executions enforce Enabled.\nfunc (cs *CronScheduler) RunJobNow(id string) error {\n\tjob := cs.store.Get(id)\n\tif job == nil {\n\t\treturn fmt.Errorf(\"%w: %q\", ErrCronJobNotFound, id)\n\t}\n\tcs.mu.RLock()\n\t_, ok := cs.engines[job.Project]\n\tcs.mu.RUnlock()\n\tif !ok {\n\t\treturn fmt.Errorf(\"%w: %q\", ErrCronProjectNotFound, job.Project)\n\t}\n\tsnapshot := *job\n\tgo cs.runJob(&snapshot, true)\n\treturn nil\n}\n\nfunc (cs *CronScheduler) runJob(job *CronJob, manual bool) {\n\tif job == nil {\n\t\treturn\n\t}\n\tif !manual && !job.Enabled {\n\t\treturn\n\t}\n\n\tcs.mu.RLock()\n\tengine, ok := cs.engines[job.Project]\n\tcs.mu.RUnlock()\n","sourceCodeStart":655,"sourceCodeEnd":691,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/cron.go#L655-L691","documentation":"RunJobNow verifies that an engine exists for the job's project before spawning the run; if the project name in the stored job has no registered engine, it returns ErrCronProjectNotFound wrapped with the project name. This fails synchronously so the caller can report a misconfigured job instead of a silent background failure.","triggerScenarios":"Calling RunJobNow on a job whose Project field references a project removed from config, renamed, or never registered in cs.engines.","commonSituations":"User renamed or deleted a project in config.toml but old cron jobs still reference the previous project name; typos in project names when jobs were created.","solutions":["Re-add or fix the project name in config.toml and restart the daemon","Edit the job's project field to reference an existing project (UpdateJob or delete/recreate the job)","Use errors.Is(err, core.ErrCronProjectNotFound) to surface which project is missing"],"exampleFix":"// before\n// config.toml has no [projects.legacy]\njob.Project = \"legacy\" // no engine registered\n// after\njob.Project = \"main\" // engine exists for \"main\"\ncs.UpdateJob(job.ID, \"project\", \"main\")","handlingStrategy":"validation","validationCode":"func projectExists(name string, engines map[string]core.Engine) bool { _, ok := engines[name]; return ok }","typeGuard":null,"tryCatchPattern":"if err := cs.RunJobNow(id); err != nil {\n    if errors.Is(err, core.ErrCronProjectNotFound) {\n        reply(\"project missing from config for this job\")\n        return nil\n    }\n    return err\n}","preventionTips":["When renaming/removing a project in config.toml, update or delete its cron jobs","Validate job project names against configured projects at creation time"],"tags":["go","cron","config","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}