chenhg5/cc-connect · error

job %q not found

Error message

job %q not found

What it means

EnableJob returns this error when store.SetEnabled(id, true) reports no job with the given ID exists, so there is nothing to enable or reschedule. Callers are executeCardAction (interactive card buttons) and cmdCronToggle.

Source

Thrown at core/cron.go:510

	if job.Enabled {
		return cs.scheduleJob(job)
	}
	return nil
}

func (cs *CronScheduler) RemoveJob(id string) bool {
	cs.mu.Lock()
	if entryID, ok := cs.entries[id]; ok {
		cs.cron.Remove(entryID)
		delete(cs.entries, id)
	}
	cs.mu.Unlock()
	return cs.store.Remove(id)
}

func (cs *CronScheduler) EnableJob(id string) error {
	if !cs.store.SetEnabled(id, true) {
		return fmt.Errorf("job %q not found", id)
	}
	job := cs.store.Get(id)
	if job != nil {
		return cs.scheduleJob(job)
	}
	return nil
}

func (cs *CronScheduler) DisableJob(id string) error {
	if !cs.store.SetEnabled(id, false) {
		return fmt.Errorf("job %q not found", id)
	}
	cs.mu.Lock()
	if entryID, ok := cs.entries[id]; ok {
		cs.cron.Remove(entryID)
		delete(cs.entries, id)
	}
	cs.mu.Unlock()

View on GitHub (pinned to 4000b2338a)

Solutions

  1. List current jobs (e.g. /cron list) and use a valid ID.
  2. Recreate the job with AddJob if it was deleted.
  3. Handle the error in UI code by refreshing the card/list instead of retrying the same ID.

Example fix

// before
if err := sched.EnableJob(id); err != nil { return err }
// after
if err := sched.EnableJob(id); err != nil {
    return fmt.Errorf("enable: %w (try /cron list for valid ids)", err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if cs.store.Get(id) == nil { return fmt.Errorf("job %q not found", id) }

Try / catch

if err := sched.EnableJob(id); err != nil {
    if strings.Contains(err.Error(), "not found") {
        // refresh UI / treat as gone
    }
    return err
}

Prevention

When it happens

Trigger: Calling CronScheduler.EnableJob with an ID that was never added, or that was removed (deleted job, store file reset, another session removed it).

Common situations: Stale cron card/buttons referencing a deleted job; IDs captured before a restart where the store was rewritten; typo'd job ID in /cron toggle.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/928449adc2eeed4d. Report an issue: GitHub.