{"record":{"id":"1ccba8e8b0d07c73","repo":"facebook/flow","slug":"init-failed","errorCode":null,"errorMessage":"init failed: {:?}","messagePattern":"init failed: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_server/src/standalone.rs","lineNumber":296,"sourceCode":"            .spawn(move || {\n                let init_result = std::panic::catch_unwind(AssertUnwindSafe(|| {\n                    flow_server_env::monitor_rpc::status_update(server_status::Event::InitStart);\n                    eprintln!(\"Initializing server...\");\n                    let init_start = std::time::Instant::now();\n                    let pool = ThreadPool::with_thread_count(\n                        flow_utils_concurrency::thread_pool::ThreadCount::NumThreads(\n                            std::num::NonZeroUsize::new(init_pool_workers)\n                                .expect(\"pool_workers should be positive\"),\n                        ),\n                    );\n                    let (env, _first_internal_error) = match type_service::init(\n                        &init_options,\n                        &pool,\n                        &init_committed_heap,\n                        None,\n                    ) {\n                        Ok(result) => result,\n                        Err(error) => panic!(\"init failed: {:?}\", error),\n                    };\n                    let mut env = server_monitor_listener_state::update_env(Arc::new(env));\n                    let init_duration = init_start.elapsed().as_secs_f64();\n                    let finishing_up_status = server_status::Status::Typechecking(\n                        server_status::TypecheckMode::Initializing,\n                        server_status::TypecheckStatus::FinishingTypecheck,\n                    );\n                    env = flow_server_env::server_env::with_connections(\n                        env,\n                        persistent_connection::all_clients(),\n                    );\n                    persistent_connection::send_status(\n                        finishing_up_status,\n                        (\n                            file_watcher_status::FileWatcher::NoFileWatcher,\n                            file_watcher_status::StatusKind::Ready,\n                        ),\n                        &env.connections,","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_server/src/standalone.rs#L278-L314","documentation":"The standalone Flow server runs type_service::init() on a thread pool during startup — this parses .flowconfig, sets up module resolution, loads libs, and allocates heaps. If init returns Err, the code panics with 'init failed: {:?}' where the debug payload IS the real error. The panic is just the outermost wrapper: diagnose the embedded error value, not this message.","triggerScenarios":"Starting the standalone server with an unreadable or invalid .flowconfig, a root that is not a directory or contains no flowconfig for the configured flowconfig_name, options the build does not accept, lib extraction failures, or heap allocation failures for very large projects.","commonSituations":"Wrong --root passed to the daemon; .flowconfig with syntax errors or options from a newer Flow release used with an older binary; flowconfig_name pointing at a custom file that is missing; corrupted temp-dir state from a previous crashed run; memory limits (cgroup) too small for init.","solutions":["Read the {:?} payload in the panic output — it names the concrete init error; that message is the actual diagnosis.","Reproduce outside the daemon: run flow check from the same root with the same flowconfig_name to surface config errors directly.","Bisect .flowconfig: comment out [options] entries until init succeeds, then re-add one by one.","Clear the flow temp dir to remove stale caches/locks and retry; verify the daemon user can read the root and the flowconfig."],"exampleFix":"# before: daemon started against a root without the named flowconfig\nflow start --root /src --flowconfig-name .flowconfig.dev  # panic: init failed: ...\n\n# after: verify the config exists, then start\ncd /src && ls .flowconfig.dev && flow start","handlingStrategy":"validation","validationCode":"# before starting the standalone daemon, prove root+flowconfig are sane\ntest -f \"$ROOT/$FLOWCONFIG\" || { echo \"no $FLOWCONFIG at $ROOT\" >&2; exit 1; }\nflow check --root \"$ROOT\" --flowconfig-name \"$FLOWCONFIG\" >/dev/null \\\n  || { echo \"flowconfig errors; fix before daemonizing\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"let r = std::panic::catch_unwind(|| start_standalone_server(opts));\nif r.is_err() {\n    // 'init failed: <error>' — the payload names the config problem;\n    // report it and keep the service in a restart-backoff loop\n    report_and_backoff();\n}","preventionTips":["Run flow check against the same root/flowconfig_name before every daemon start in scripts.","Pin the flowconfig options to the release you deploy; check release notes on upgrades.","Give the daemon a clean temp dir between attempts; stale caches cause init failures.","Capture stderr of the daemon so the {:?} init error payload is never lost."],"tags":["server","initialization","flowconfig","startup","type-service"],"backgroundTag":"server-initialization-failed","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T06:17:17.905Z"}