{"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":809,"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":791,"sourceCodeEnd":827,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/dev.rs#L791-L827","documentation":"The fail-fast check after starting the dev client calls `try_wait()`; if that OS-level call itself returns `Err` (rather than an exit status), the CLI bails with the underlying error. This is an infrastructure failure of process introspection — on Unix typically ECHILD/EINVAL from waitpid (e.g. the child was already reaped by something else) — not a normal client crash.","triggerScenarios":"The child process being reaped by a signal handler or a wrapper that double-waits; PID namespace / container quirks (docker, sandboxed CI) breaking waitpid; extremely unusual process teardown racing the 200ms check.","commonSituations":"Running `spacetime dev` inside minimal containers or devcontainers with custom init processes; client commands launched through shell wrappers that forward or detach signals.","solutions":["Retry `spacetime dev` — races like this are transient","Run the client command outside the dev loop to confirm it works standalone","If in a container, run with a proper init (docker `--init`) and standard signal handling","Report with the appended OS error text if it reproduces consistently"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// On 'Failed to check client process status', treat as transient: tear down the dev loop and restart it once; escalate only if the appended OS error repeats.","preventionTips":["Run containers with a proper init (--init) so child reaping behaves","Avoid wrappers that double-fork or reap children behind the CLI"],"tags":["cli","subprocess","os","spacetimedb"],"backgroundTag":"process-wait-error","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}