facebook/flow · error
workers required for recheck
Error message
workers required for recheck
What it means
The codemod recheck step does `workers.as_ref().expect("workers required for recheck")`. As in the init step, `Genv.workers` is `None` exactly when `options.max_workers == 0` (`make_genv` only builds a pool for max_workers > 0); recheck requires the pool, so the zero-worker configuration panics here.
Source
Thrown at rust_port/crates/flow_codemods/src/utils/codemod_runner.rs:1234
}
#[allow(unreachable_code)]
async fn recheck_run(
_genv: &Genv,
env: Self::Env,
_iteration: i32,
_roots: BTreeSet<FileKey>,
) -> Result<
((), (Self::Env, ResultList<Self::Accumulator>)),
flow_utils_concurrency::worker_cancel::WorkerCanceled,
> {
let options = &*_genv.options;
let workers = &_genv.workers;
let should_print_summary = options.profile;
let profiling = profiling_start("Codemod", should_print_summary);
diff_heaps_remove_batch(&_roots);
let options_arc = Arc::new(options.clone());
let pool = workers.as_ref().expect("workers required for recheck");
let mut updates = flow_common_utils::checked_set::CheckedSet::empty();
let focused_set: flow_data_structure_wrapper::ord_set::FlowOrdSet<FileKey> =
_roots.iter().cloned().collect();
updates.add(Some(focused_set), None, None);
let find_ref_request = flow_services_references::find_refs_types::empty_request();
let files_to_force = flow_common_utils::checked_set::CheckedSet::empty();
let mut will_be_checked_files = flow_common_utils::checked_set::CheckedSet::empty();
let recheck_result = flow_services_inference::type_service::recheck(
pool,
&_genv.committed_heap,
&options_arc,
&updates,
&find_ref_request,
files_to_force,
false,
None, // changed_mergebase
false, // missed_changes
&mut will_be_checked_files,View on GitHub (pinned to f88ac94bcf)
Solutions
- Set max_workers to at least 1 (drop `--max-workers 0` or override it with `--max-workers N`).
- Audit the flowconfig/CLI/env chain that produces max_workers=0 and correct it.
- When building Genv programmatically, ensure `make_genv` sees max_workers > 0 before running recheck-based codemods.
Example fix
// before
let pool = workers.as_ref().expect("workers required for recheck");
// after
let Some(pool) = workers.as_ref() else {
eprintln!("codemod recheck requires at least one worker (max_workers is 0)");
std::process::exit(2);
}; Defensive patterns
Strategy: validation
Validate before calling
// Fail fast with a clear message instead of a panic inside recheck
assert!(options.max_workers >= 1,
"codemod recheck requires max_workers >= 1 (got {})", options.max_workers); Try / catch
let Some(pool) = workers.as_ref() else {
eprintln!("recheck needs a worker pool; set max_workers >= 1");
std::process::exit(2);
}; Prevention
- Treat 0 as invalid for max_workers in codemod contexts; use 1 for single-threaded intent.
- Keep worker-count configuration in one place so contradictory values cannot reach the runner.
- Add a startup check for max_workers in codemod main functions.
When it happens
Trigger: Running a codemod with `--max-workers 0` or an equivalent config/env override; invoking the runner against a Genv built without a worker pool.
Common situations: Single-threaded intents expressed as `--max-workers 0`; config templates that zero out worker counts; test harnesses reusing a minimal Genv.
Related errors
- workers required for init
- $FLOW_STACK_SIZE must be a number, got {s}
- ensure_parsed_or_trigger_recheck failed
- recheck failed
- ${message}
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/318dad65e427dd9e.
Report an issue: GitHub.