wasmerio/wasmer · error · anyhow::Error

cron job ' ' not found

Error message

cron job '{cron_job}' not found

What it means

get_cron_job_invocations_page paginates the backend API looking for a cron job with the given name; if the loop finishes without matching, it bails with "cron job '{cron_job}' not found". It means the queried registry/backend has no cron job with that identifier visible to the current credentials.

Solutions

  1. Verify the cron job name (list cron jobs for the app first via the backend API).
  2. Check the auth token's scope/namespace matches the owner of the cron job.
  3. Use get_cron_job_invocations_page_by_id with the resolved cron job ID instead of the name.
  4. Confirm you are pointed at the right registry/endpoint (production vs staging).

Example fix

// before
let page = get_cron_job_invocations_page(&client, "deploy-nightly", window).await?;
// after: resolve and check first
let jobs = list_cron_jobs(&client, app_id).await?;
let job = jobs.iter().find(|j| j.name == "deploy-nightly")
    .context("cron job 'deploy-nightly' does not exist for this app")?;
let page = get_cron_job_invocations_page_by_id(&client, job.id.clone(), window).await?;
Defensive patterns

Strategy: try-catch

Try / catch

match get_cron_job_invocations_page(&client, name, window).await {
    Ok(page) => page,
    Err(e) if e.to_string().contains("not found") => {
        eprintln!("cron job '{name}' missing — listing available jobs...");
        // fall back to listing cron jobs or return a typed NotFound error
        Default::default()
    }
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: Calling get_cron_job_invocations_page(client, name, ...) with a cron job name that does not exist, is misspelled, or belongs to another app/namespace/owner the token cannot see.

Common situations: Typo in the cron job name; cron job deleted or renamed; using a token scoped to a different namespace; environment mismatch (staging vs production registry).

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 wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/0203c75fc2cafd37. Report an issue: GitHub.

Appendix: source

Thrown at lib/backend-api/src/query.rs:501

                .then(|| cron.invocations.page_info.end_cursor.clone())
                .flatten();

            return Ok((
                cron,
                Paginated {
                    items: invocations,
                    next_cursor,
                },
            ));
        }

        if !page_info.has_next_page {
            break;
        }
        cron_after = Some(page_info.end_cursor.context("cron jobs cursor missing")?);
    }

    bail!("cron job '{cron_job}' not found")
}

/// Retrieve one page of invocations for a cron job referenced by id.
pub async fn get_cron_job_invocations_page_by_id(
    client: &WasmerClient,
    cron_job_id: impl Into<String>,
    invocation_after: Option<String>,
    invocation_first: Option<i32>,
    start: Option<OffsetDateTime>,
    end: Option<OffsetDateTime>,
) -> Result<
    (
        types::CronJobWithInvocationsById,
        Paginated<types::CronJobInvocation>,
    ),
    anyhow::Error,
> {
    let cron_job_id = cron_job_id.into();

View on GitHub (pinned to 8c4b9ee9d3)