tinyhumansai/openhuman · error

Cron job '{job_id}' not found

Error message

Cron job '{job_id}' not found

What it means

get_job ran SELECT ... FROM cron_jobs WHERE id = ?1 and got no row back, so the lookup bails naming the missing id. Every id-addressed cron operation (get, update, run) funnels through this read and reports not-found identically.

Source

Thrown at src/openhuman/cron/store.rs:268

        }
        Ok(jobs)
    })
}

pub fn get_job(config: &Config, job_id: &str) -> Result<CronJob> {
    with_connection(config, |conn| {
        let mut stmt = conn.prepare(
            "SELECT id, expression, command, schedule, job_type, prompt, name, session_target, model,
                    enabled, delivery, delete_after_run, created_at, next_run, last_run, last_status, last_output,
                    agent_id, profile_id
             FROM cron_jobs WHERE id = ?1",
        )?;

        let mut rows = stmt.query(params![job_id])?;
        if let Some(row) = rows.next()? {
            map_cron_job_row(row).map_err(Into::into)
        } else {
            anyhow::bail!("Cron job '{job_id}' not found")
        }
    })
}

pub fn remove_job(config: &Config, id: &str) -> Result<()> {
    let changed = with_connection(config, |conn| {
        conn.execute("DELETE FROM cron_jobs WHERE id = ?1", params![id])
            .context("Failed to delete cron job")
    })?;

    if changed == 0 {
        anyhow::bail!("Cron job '{id}' not found");
    }

    println!("✅ Removed cron job {id}");
    Ok(())
}

View on GitHub (pinned to 7491200858)

Solutions

  1. Run cron list (cron_list) and re-copy the exact id
  2. Verify the workspace: check config.workspace_dir / OPENHUMAN_WORKSPACE and the active user profile
  3. If the job is gone, re-create it and update the referencing script with the new id

Example fix

# before
openhuman cron update 6f1c2a... --name x   # stale id

# after
openhuman cron list                        # find the current id
openhuman cron update <fresh-id> --name x
Defensive patterns

Strategy: try-catch

Validate before calling

let exists = list_jobs(&config)?.iter().any(|j| j.id == id);
if !exists {
    // skip / prompt instead of erroring downstream
}

Try / catch

let job = get_job(&config, id).map_err(|e| {
    if e.to_string().contains("not found") { ApiError::NotFound(id.to_string()) } else { ApiError::Internal(e) }
})?; // surface 404-style to the caller and offer a list refresh

Prevention

When it happens

Trigger: cron.get/update/run-now with an id from a stale listing (job deleted meanwhile); a typo'd or case-mismatched id; operating against a different workspace — config.workspace_dir is per-user/per-workspace, so the cron.db being queried is not the one holding the job.

Common situations: Two terminals with different OPENHUMAN_WORKSPACE/action_dir; a job removed from another UI session or by another admin; ids copied from truncated 'cron list' output; scripts referencing ids after a workspace migration.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/cb4edff32b4c1597. Report an issue: GitHub.