{"record":{"id":"9ce191c43e96c6a6","repo":"libnyanpasu/clash-nyanpasu","slug":"no-promoted-runtime-snapshot-refresh-the-inspecti","errorCode":null,"errorMessage":"no promoted runtime snapshot; refresh the inspection","messagePattern":"no promoted runtime snapshot; refresh the inspection","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/tauri/src/client/runtime_inspection.rs","lineNumber":135,"sourceCode":"                .collect(),\n        })\n    }\n}\n\nimpl NyanpasuClient {\n    pub async fn inspect_runtime(&self) -> Option<RuntimeInspection> {\n        self.promoted_runtime()\n            .await\n            .map(|snapshot| snapshot.inspection_summary())\n    }\n\n    pub async fn inspect_runtime_node(\n        &self,\n        snapshot_id: &str,\n        node_id: u32,\n    ) -> anyhow::Result<RuntimeInspectionContent> {\n        let snapshot = self.promoted_runtime().await.ok_or_else(|| {\n            anyhow::anyhow!(\"no promoted runtime snapshot; refresh the inspection\")\n        })?;\n        let snapshot_id = snapshot_id.to_owned();\n        tokio::task::spawn_blocking(move || snapshot.inspection_content(&snapshot_id, node_id))\n            .await?\n    }\n}\n\n#[cfg(test)]\npub(crate) mod tests {\n    use super::*;\n    use crate::{\n        client::runtime::{RuntimeRevisionAllocator, RuntimeSnapshotData},\n        enhance::PostProcessingOutput,\n    };\n    use nyanpasu_config::{\n        application::ClashCore,\n        runtime::{executor::StepLogLevel, snapshot::ConfigSnapshotsBuilder, value::ConfigValue},\n    };","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/tauri/src/client/runtime_inspection.rs#L117-L153","documentation":"Thrown by `NyanpasuClient::inspect_runtime_node` when no runtime snapshot is currently promoted (`promoted_runtime()` returned None). Inspection only works against a promoted (committed) config build; if the runtime has not been built yet, was never promoted, or the promotion was replaced/cleared, there is nothing to inspect and the client refuses the call.","triggerScenarios":"Calling `inspect_runtime_node` before the first successful runtime config build after app startup; calling after the promoted snapshot was invalidated (e.g. failed config patch, core shutdown) with no new promotion; calling when the runtime state actor has not yet produced its first snapshot.","commonSituations":"UI inspection panel opens before initial config load completes; race between a config re-build (which briefly un-promotes) and a node-detail request; app started with an invalid profile so no runtime was ever promoted.","solutions":["Trigger/await a runtime config build (e.g. patch config or reload profiles) so a snapshot gets promoted, then retry.","Only enable the inspection UI after `inspect_runtime()` returns Some(summary).","Catch this error and show a 'no runtime config built yet — refresh' state instead of surfacing it as a failure.","Re-check `inspect_runtime()`; if it returns None, the app genuinely has no runtime snapshot and inspection is unavailable."],"exampleFix":"// before\nlet content = client.inspect_runtime_node(&snapshot_id, node_id).await?;\n// after\nif client.inspect_runtime().await.is_none() {\n    anyhow::bail!(\"no runtime inspection available; build the config first\");\n}\nlet content = client.inspect_runtime_node(&snapshot_id, node_id).await?;","handlingStrategy":"try-catch","validationCode":"let has_runtime = client.inspect_runtime().await.is_some();\nif !has_runtime {\n    anyhow::bail!(\"runtime not built yet; trigger a config build first\");\n}","typeGuard":"fn inspection_available(summary: &Option<RuntimeInspection>) -> bool {\n    summary.is_some()\n}","tryCatchPattern":"match client.inspect_runtime_node(&sid, nid).await {\n    Ok(c) => c,\n    Err(e) if e.to_string().contains(\"no promoted runtime snapshot\") => {\n        // surface a 'build config first / refresh' state instead of an error\n        Default::default()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Gate the inspection UI on inspect_runtime() returning Some","Await the initial config build before allowing inspection calls","Treat un-promoted runtime as an expected pre-startup state, not an error","Re-check promotion after any failed config patch or core shutdown"],"tags":["rust","not-initialized","snapshot","missing-state"],"backgroundTag":"resource-not-found","analyzedSha":"f7dbce2997c633e484f54788035e770b3ee99773","analyzedAt":"2026-09-08T01:24:59.197Z","contentChangedAt":"2026-09-08T01:24:59.197Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}