libnyanpasu/clash-nyanpasu · warning

no promoted runtime snapshot; refresh the inspection

Error message

no promoted runtime snapshot; refresh the inspection

What it means

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.

Source

Thrown at backend/tauri/src/client/runtime_inspection.rs:135

                .collect(),
        })
    }
}

impl NyanpasuClient {
    pub async fn inspect_runtime(&self) -> Option<RuntimeInspection> {
        self.promoted_runtime()
            .await
            .map(|snapshot| snapshot.inspection_summary())
    }

    pub async fn inspect_runtime_node(
        &self,
        snapshot_id: &str,
        node_id: u32,
    ) -> anyhow::Result<RuntimeInspectionContent> {
        let snapshot = self.promoted_runtime().await.ok_or_else(|| {
            anyhow::anyhow!("no promoted runtime snapshot; refresh the inspection")
        })?;
        let snapshot_id = snapshot_id.to_owned();
        tokio::task::spawn_blocking(move || snapshot.inspection_content(&snapshot_id, node_id))
            .await?
    }
}

#[cfg(test)]
pub(crate) mod tests {
    use super::*;
    use crate::{
        client::runtime::{RuntimeRevisionAllocator, RuntimeSnapshotData},
        enhance::PostProcessingOutput,
    };
    use nyanpasu_config::{
        application::ClashCore,
        runtime::{executor::StepLogLevel, snapshot::ConfigSnapshotsBuilder, value::ConfigValue},
    };

View on GitHub (pinned to f7dbce2997)

Solutions

  1. Trigger/await a runtime config build (e.g. patch config or reload profiles) so a snapshot gets promoted, then retry.
  2. Only enable the inspection UI after `inspect_runtime()` returns Some(summary).
  3. Catch this error and show a 'no runtime config built yet — refresh' state instead of surfacing it as a failure.
  4. Re-check `inspect_runtime()`; if it returns None, the app genuinely has no runtime snapshot and inspection is unavailable.

Example fix

// before
let content = client.inspect_runtime_node(&snapshot_id, node_id).await?;
// after
if client.inspect_runtime().await.is_none() {
    anyhow::bail!("no runtime inspection available; build the config first");
}
let content = client.inspect_runtime_node(&snapshot_id, node_id).await?;
Defensive patterns

Strategy: try-catch

Validate before calling

let has_runtime = client.inspect_runtime().await.is_some();
if !has_runtime {
    anyhow::bail!("runtime not built yet; trigger a config build first");
}

Type guard

fn inspection_available(summary: &Option<RuntimeInspection>) -> bool {
    summary.is_some()
}

Try / catch

match client.inspect_runtime_node(&sid, nid).await {
    Ok(c) => c,
    Err(e) if e.to_string().contains("no promoted runtime snapshot") => {
        // surface a 'build config first / refresh' state instead of an error
        Default::default()
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08). Data as JSON: /api/errors/9ce191c43e96c6a6. Report an issue: GitHub.