{"record":{"id":"318dad65e427dd9e","repo":"facebook/flow","slug":"workers-required-for-recheck","errorCode":null,"errorMessage":"workers required for recheck","messagePattern":"workers required for recheck","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_codemods/src/utils/codemod_runner.rs","lineNumber":1234,"sourceCode":"    }\n\n    #[allow(unreachable_code)]\n    async fn recheck_run(\n        _genv: &Genv,\n        env: Self::Env,\n        _iteration: i32,\n        _roots: BTreeSet<FileKey>,\n    ) -> Result<\n        ((), (Self::Env, ResultList<Self::Accumulator>)),\n        flow_utils_concurrency::worker_cancel::WorkerCanceled,\n    > {\n        let options = &*_genv.options;\n        let workers = &_genv.workers;\n        let should_print_summary = options.profile;\n        let profiling = profiling_start(\"Codemod\", should_print_summary);\n        diff_heaps_remove_batch(&_roots);\n        let options_arc = Arc::new(options.clone());\n        let pool = workers.as_ref().expect(\"workers required for recheck\");\n        let mut updates = flow_common_utils::checked_set::CheckedSet::empty();\n        let focused_set: flow_data_structure_wrapper::ord_set::FlowOrdSet<FileKey> =\n            _roots.iter().cloned().collect();\n        updates.add(Some(focused_set), None, None);\n        let find_ref_request = flow_services_references::find_refs_types::empty_request();\n        let files_to_force = flow_common_utils::checked_set::CheckedSet::empty();\n        let mut will_be_checked_files = flow_common_utils::checked_set::CheckedSet::empty();\n        let recheck_result = flow_services_inference::type_service::recheck(\n            pool,\n            &_genv.committed_heap,\n            &options_arc,\n            &updates,\n            &find_ref_request,\n            files_to_force,\n            false,\n            None,  // changed_mergebase\n            false, // missed_changes\n            &mut will_be_checked_files,","sourceCodeStart":1216,"sourceCodeEnd":1252,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_codemods/src/utils/codemod_runner.rs#L1216-L1252","documentation":"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.","triggerScenarios":"Running a codemod with `--max-workers 0` or an equivalent config/env override; invoking the runner against a Genv built without a worker pool.","commonSituations":"Single-threaded intents expressed as `--max-workers 0`; config templates that zero out worker counts; test harnesses reusing a minimal Genv.","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."],"exampleFix":"// before\nlet pool = workers.as_ref().expect(\"workers required for recheck\");\n\n// after\nlet Some(pool) = workers.as_ref() else {\n    eprintln!(\"codemod recheck requires at least one worker (max_workers is 0)\");\n    std::process::exit(2);\n};","handlingStrategy":"validation","validationCode":"// Fail fast with a clear message instead of a panic inside recheck\nassert!(options.max_workers >= 1,\n    \"codemod recheck requires max_workers >= 1 (got {})\", options.max_workers);","typeGuard":null,"tryCatchPattern":"let Some(pool) = workers.as_ref() else {\n    eprintln!(\"recheck needs a worker pool; set max_workers >= 1\");\n    std::process::exit(2);\n};","preventionTips":["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."],"tags":["codemod","configuration","thread-pool","recheck"],"backgroundTag":"invalid-configuration-value","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T06:17:17.905Z"}