chenhg5/cc-connect · error
ErrCronProjectNotFound
ErrCronProjectNotFound
Error message
%w: %q
What it means
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.
Source
Thrown at core/cron.go:673
job := cs.store.Get(jobID)
if job == nil {
return
}
cs.runJob(job, false)
}
// RunJobNow triggers a persisted cron job immediately in the background.
// Disabled jobs are allowed to run manually; only scheduled executions enforce Enabled.
func (cs *CronScheduler) RunJobNow(id string) error {
job := cs.store.Get(id)
if job == nil {
return fmt.Errorf("%w: %q", ErrCronJobNotFound, id)
}
cs.mu.RLock()
_, ok := cs.engines[job.Project]
cs.mu.RUnlock()
if !ok {
return fmt.Errorf("%w: %q", ErrCronProjectNotFound, job.Project)
}
snapshot := *job
go cs.runJob(&snapshot, true)
return nil
}
func (cs *CronScheduler) runJob(job *CronJob, manual bool) {
if job == nil {
return
}
if !manual && !job.Enabled {
return
}
cs.mu.RLock()
engine, ok := cs.engines[job.Project]
cs.mu.RUnlock()
View on GitHub (pinned to 4000b2338a)
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
Example fix
// before // config.toml has no [projects.legacy] job.Project = "legacy" // no engine registered // after job.Project = "main" // engine exists for "main" cs.UpdateJob(job.ID, "project", "main")
Defensive patterns
Strategy: validation
Validate before calling
func projectExists(name string, engines map[string]core.Engine) bool { _, ok := engines[name]; return ok } Try / catch
if err := cs.RunJobNow(id); err != nil {
if errors.Is(err, core.ErrCronProjectNotFound) {
reply("project missing from config for this job")
return nil
}
return err
} Prevention
- When renaming/removing a project in config.toml, update or delete its cron jobs
- Validate job project names against configured projects at creation time
When it happens
Trigger: Calling RunJobNow on a job whose Project field references a project removed from config, renamed, or never registered in cs.engines.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/e8d3e4adab3fb18e.
Report an issue: GitHub.