{"record":{"id":"878424957f0f4ff1","repo":"chenhg5/cc-connect","slug":"errcronjobnotfound","errorCode":"ErrCronJobNotFound","errorMessage":"%w: %q","messagePattern":"%w: %q","errorType":"exception","errorClass":null,"httpStatus":404,"severity":"error","filePath":"core/cron.go","lineNumber":667,"sourceCode":"\t}\n\tcs.entries[jobID] = entryID\n\treturn nil\n}\n\nfunc (cs *CronScheduler) executeJob(jobID string) {\n\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","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/cron.go#L649-L685","documentation":"RunJobNow looks up the persisted cron job by id; if the store has no job with that id it returns ErrCronJobNotFound wrapped with the quoted id. Manual runs use the same store as scheduled runs, so unknown or deleted ids fail synchronously with this sentinel error.","triggerScenarios":"Calling RunJobNow with an id that was never created, was deleted via a remove/edit flow, or a typo'd/stale id from handleCronExec or cmdCronExec.","commonSituations":"User runs a /cron exec command with an id copied from an old listing; the job was removed by another session before the manual trigger arrives.","solutions":["List current jobs (handleCron listing) and use a valid id","Use errors.Is(err, core.ErrCronJobNotFound) to return a friendly 'job not found' message to the user","If the id should exist, check that the daemon is pointed at the expected store file"],"exampleFix":"// before\nif err := cs.RunJobNow(id); err != nil { return err }\n// after\nif err := cs.RunJobNow(id); err != nil {\n    if errors.Is(err, core.ErrCronJobNotFound) {\n        return fmt.Errorf(\"cron job %q does not exist; use /cron list\", id)\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"if cs.Store().Get(id) == nil { return fmt.Errorf(\"job %q not found\", id) }","typeGuard":null,"tryCatchPattern":"if err := cs.RunJobNow(id); err != nil {\n    if errors.Is(err, core.ErrCronJobNotFound) {\n        reply(\"cron job not found: \" + id)\n        return nil\n    }\n    return err\n}","preventionTips":["Always list jobs to obtain fresh ids; never reuse ids from old listings","Treat ErrCronJobNotFound via errors.Is rather than string matching"],"tags":["go","cron","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"}