{"record":{"id":"cb1e65c28ef0071d","repo":"rust-lang/rust","slug":"cannot-determine-the-type-of-workflow-that-is-bein","errorCode":null,"errorMessage":"Cannot determine the type of workflow that is being executed","messagePattern":"Cannot determine the type of workflow that is being executed","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ci/citool/src/jobs.rs","lineNumber":376,"sourceCode":"                env,\n                continue_on_error: job.continue_on_error,\n                free_disk: job.free_disk,\n                doc_url: job.doc_url,\n                codebuild: job.codebuild,\n            }\n        })\n        .collect();\n\n    Ok(jobs)\n}\n\npub fn calculate_job_matrix(\n    db: JobDatabase,\n    gh_ctx: GitHubContext,\n    channel: &str,\n) -> anyhow::Result<()> {\n    let run_type = gh_ctx.get_run_type().ok_or_else(|| {\n        anyhow::anyhow!(\"Cannot determine the type of workflow that is being executed\")\n    })?;\n    eprintln!(\"Run type: {run_type:?}\");\n\n    let jobs = calculate_jobs(&run_type, &db, channel)?;\n    if jobs.is_empty() && !matches!(run_type, RunType::MainJob) {\n        return Err(anyhow::anyhow!(\"Computed job list is empty\"));\n    }\n\n    let run_type = match run_type {\n        RunType::PullRequest => \"pr\",\n        RunType::TryJob { .. } => \"try\",\n        RunType::AutoJob => \"auto\",\n        RunType::MainJob => \"main\",\n    };\n\n    eprintln!(\"Output\");\n    eprintln!(\"jobs={jobs:?}\");\n    eprintln!(\"run_type={run_type}\");","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/src/ci/citool/src/jobs.rs#L358-L394","documentation":"Thrown by citool's calculate_job_matrix when GitHubContext::get_run_type() returns None. get_run_type matches the GITHUB_EVENT_NAME and GITHUB_REF environment variables against a fixed allowlist: pull_request events, or push events to the branches automation/bors/try, automation/bors/try-perf, automation/bors/auto, or main. Any other (event, ref) pair yields None, so citool cannot decide which job set to schedule and aborts.","triggerScenarios":"Invoking the calculate-job-matrix subcommand with GITHUB_EVENT_NAME/GITHUB_REF set to an unrecognized combination, e.g. event=workflow_dispatch, event=schedule, event=release, or a push to a feature branch like refs/heads/feature/foo.","commonSituations":"Running citool locally for testing without the GitHub env vars populated; a CI workflow triggered by a new event type that the matrix logic was never taught to handle; bors branch refs renamed so the literal string match in get_run_type no longer fires.","solutions":["Set GITHUB_EVENT_NAME to pull_request or push, and GITHUB_REF to one of the recognized branch refs (refs/heads/main, refs/heads/automation/bors/try, etc.).","If a genuinely new workflow event must be scheduled, add a match arm to GitHubContext::get_run_type in src/ci/citool/src/main.rs mapping it to a RunType variant.","For reproducing a job locally, call the local-execution subcommand (which takes a job name directly) instead of calculate-job-matrix."],"exampleFix":"// before\n$ GITHUB_EVENT_NAME=workflow_dispatch GITHUB_REF=refs/heads/main citool calculate-job-matrix\nError: Cannot determine the type of workflow that is being executed\n\n// after (use a recognized event/branch pair)\n$ GITHUB_EVENT_NAME=pull_request GITHUB_REF=refs/pull/123/merge citool calculate-job-matrix","handlingStrategy":"validation","validationCode":"// Before calling calculate_job_matrix, verify the event/ref pair is recognized.\nfn is_supported_run_type(event_name: &str, branch_ref: &str) -> bool {\n    matches!(\n        (event_name, branch_ref),\n        (\"pull_request\", _)\n        | (\"push\", \"refs/heads/automation/bors/try-perf\")\n        | (\"push\", \"refs/heads/try-perf\")\n        | (\"push\", \"refs/heads/automation/bors/try\")\n        | (\"push\", \"refs/heads/automation/bors/auto\")\n        | (\"push\", \"refs/heads/main\")\n    )\n}\n\nif !is_supported_run_type(&gh_ctx.event_name, &gh_ctx.branch_ref) {\n    eprintln!(\"Unsupported GitHub event/ref; cannot determine run type\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set both GITHUB_EVENT_NAME and GITHUB_REF when invoking citool's matrix command.","When adding a new CI workflow event, update GitHubContext::get_run_type in the same change.","Document the recognized (event, ref) pairs for contributors running citool locally."],"tags":["ci","citool","github-actions","configuration","environment-variables"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}