{"record":{"id":"1a4cbe009d7cf57d","repo":"clockworklabs/SpacetimeDB","slug":"failed-to-check-client-process-status","errorCode":null,"errorMessage":"Failed to check client process status: {}","messagePattern":"Failed to check client process status: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/dev.rs","lineNumber":832,"sourceCode":"    let server_host_url = config.get_host_url(Some(server_for_client))?;\n    let mut client_handle = if let Some(ref cmd) = client_command {\n        let mut child = start_client_process(cmd, &project_dir, db_name_for_client, &server_host_url)?;\n\n        // Give the process a moment to fail fast (e.g., command not found, missing deps)\n        sleep(Duration::from_millis(200)).await;\n        match child.try_wait() {\n            Ok(Some(status)) if !status.success() => {\n                anyhow::bail!(\n                    \"Client command '{}' failed immediately with exit code: {}\",\n                    cmd,\n                    status\n                        .code()\n                        .map(|c| c.to_string())\n                        .unwrap_or_else(|| \"unknown\".to_string())\n                );\n            }\n            Err(e) => {\n                anyhow::bail!(\"Failed to check client process status: {}\", e);\n            }\n            _ => {} // Still running or exited successfully (unusual but ok)\n        }\n        Some(child)\n    } else {\n        None\n    };\n\n    let gitignore = build_gitignore_matcher(&project_dir, &spacetimedb_dir);\n\n    let (tx, rx) = channel();\n    let mut watcher: RecommendedWatcher = Watcher::new(\n        move |res: Result<Event, notify::Error>| {\n            if let Ok(event) = res\n                && matches!(\n                    event.kind,\n                    notify::EventKind::Modify(_) | notify::EventKind::Create(_) | notify::EventKind::Remove(_)\n                )","sourceCodeStart":814,"sourceCodeEnd":850,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/3653d2ed498fddbd83b7062aa6bf8970e18635ec/crates/cli/src/subcommands/dev.rs#L814-L850","documentation":"While `spacetime dev` polls the spawned client process, the OS-level waitpid call behind try_wait() returned an error instead of a status. This means the CLI can no longer observe the child (classic cause: ECHILD, the child was already reaped by something else, e.g. a signal handler, an exiting wrapper shell that detached the grandchild, or a container/PID-namespace quirk). It is rare infrastructure noise, not a bug in your module.","triggerScenarios":"Client command that daemonizes or backgrounds itself (nohup, `&`, a wrapper that execs and exits); process reaped by a supervisor or shell job control before the CLI polls it; running `spacetime dev` inside minimal containers with unusual PID reaping.","commonSituations":"Client command like `npm run dev &` or a tool that forks to background; tmux/screen job-control interference; occasional flake in CI runners with aggressive process cleanup.","solutions":["Remove backgrounding/daemonizing from the client command so the spawned process stays in the foreground","Simply rerun `spacetime dev`; a one-off reap race usually does not recur","Upgrade the SpacetimeDB CLI in case the polling logic was fixed","Run the client manually in a second terminal instead of through `spacetime dev`"],"exampleFix":"# before (spacetime.json)\n\"client\": \"nohup npm run dev &\"\n# after\n\"client\": \"npm run dev\"","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n    match run_dev().await {\n        Err(e) if e.to_string().contains(\"Failed to check client process status\") && attempt < 2 => continue,\n        rest => break rest,\n    }\n}","preventionTips":["Never background/daemonize the client command in spacetime.json","Keep the client process in the foreground so the CLI can own its lifetime"],"tags":["spacetime-dev","child-process","waitpid","os"],"backgroundTag":"waitpid-echild","analyzedSha":"3653d2ed498fddbd83b7062aa6bf8970e18635ec","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}