{"record":{"id":"2e9bbe4b0fbdb23e","repo":"clockworklabs/SpacetimeDB","slug":"module-inspection-cancelled","errorCode":null,"errorMessage":"Module inspection cancelled","messagePattern":"Module inspection cancelled","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/cli/src/schema_extract.rs","lineNumber":148,"sourceCode":"                .arg(&module)\n                .arg(\"--host-type\")\n                .arg(host_type.to_ascii_lowercase())\n                .stdin(Stdio::null())\n                .stdout(Stdio::piped())\n                .stderr(Stdio::null())\n                .kill_on_drop(true);\n            configure_inspector_environment(&mut command);\n            let mut child = command.spawn().context(\"Cannot start local module schema inspection\")?;\n            observation.started(child.id());\n            let mut output = Vec::new();\n            let mut stdout = child\n                .stdout\n                .take()\n                .context(\"Module inspection stdout unavailable\")?\n                .take(MAX_SCHEMA_BYTES + 1);\n            let result = tokio::select! {\n                biased;\n                _ = send.closed() => Err(anyhow::anyhow!(\"Module inspection cancelled\")),\n                result = tokio::time::timeout(deadline, async {\n                    stdout.read_to_end(&mut output).await.context(\"Cannot read local module schema\")?;\n                    ensure!(output.len() as u64 <= MAX_SCHEMA_BYTES, \"Local module schema exceeds output limit\");\n                    let status = child.wait().await.context(\"Cannot reap local module inspector\")?;\n                    observation.reaped(status);\n                    ensure!(status.success(), \"Local module schema inspection failed\");\n                    Ok(())\n                }) => result.unwrap_or_else(|_| Err(anyhow::anyhow!(\"Local module schema inspection timed out\"))),\n            };\n            if result.is_err() {\n                // Queue termination, then retain ownership through positive reaping.\n                let _ = child.start_kill();\n                let status = child\n                    .wait()\n                    .await\n                    .context(\"Cannot reap failed local module inspector\")?;\n                observation.reaped(status);\n            }","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/cli/src/schema_extract.rs#L130-L166","documentation":"Inside inspect_observed, a biased tokio::select! races the inspection child process against a cancellation channel. If the result sender (send) is dropped/closed — i.e. the caller gave up — the future resolves early with 'Module inspection cancelled' and the child is killed afterwards.","triggerScenarios":"The owner of the inspection request drops the oneshot sender (e.g. the outer future is aborted, caller times out upstream, or request context is cancelled) while the inspector child process is still running.","commonSituations":"CLI requests cancelled by the user (Ctrl-C), HTTP connections closed mid-extraction, or an outer timeout firing and dropping the inspect future.","solutions":["Retry the schema extraction and let it finish without cancelling.","Investigate what dropped/closed the channel upstream (outer timeout, dropped future, closed connection).","If cancellation is expected, treat this error as benign cleanup of the inspector child process.","Increase any upstream deadline so inspection is not aborted prematurely."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().contains(\"cancelled\") => { /* benign: caller dropped request */ }, other => other? }","preventionTips":["Don't abort extraction futures mid-flight unnecessarily","Set realistic upstream deadlines","Keep connections open until extraction completes"],"tags":["cancellation","async","tokio","rust"],"backgroundTag":"request-timeout","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-09-20T12:15:59.611Z","contentChangedAt":"2026-09-20T12:15:59.611Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}