AprilNEA/OpenLogi · error

the running Agent disconnected before semantic capture…

Error message

the running Agent disconnected before semantic capture could begin

What it means

The inner-error sibling of [76]: the `declare_client` tarpc call itself returned `Err`, meaning the agent dropped the connection or rejected the client registration mid-call. Capture aborts before any snapshot is taken.

Solutions

  1. Retry once the agent is stable — check `pgrep openlogi-agent` before and after
  2. Restart the agent cleanly and ensure it isn't crash-looping (check its logs)
  3. Align CLI and agent versions so the wire types deserialize correctly
  4. Re-run capture when no agent shutdown/restart is in progress
Defensive patterns

Strategy: retry

Validate before calling

// confirm agent stability before capture
let before = agent_pid();
tokio::time::sleep(Duration::from_secs(2)).await;
if agent_pid() != before {
    eprintln!("agent is restart-looping; stabilize it before capture");
}

Try / catch

match capture_connected_profile(&conn, ...).await {
    Err(e) if e.to_string().contains("disconnected before semantic capture") => {
        eprintln!("agent dropped the connection; check agent logs and retry");
    }
    other => other,
}

Prevention

When it happens

Trigger: The agent process exits or its connection breaks while handling `declare_client(ClientKind::Cli)` — agent crash, shutdown during capture, bincode/serialization failure of the request, or the agent refusing the client kind.

Common situations: Agent auto-restarting (crash loop) right as capture begins; killing the agent/ quitting the GUI during a long record session; version-skew causing deserialization failure of the declare request.

Related errors


AI-assisted analysis of AprilNEA/OpenLogi@e846e6f4b4 (2026-09-13). Data as JSON: /api/errors/6bd432dd119499dd. Report an issue: GitHub.

Appendix: source

Thrown at crates/openlogi-cli/src/cmd/fixture/record_profile.rs:143

    name: String,
) -> Result<CapturedProfile> {
    if connection.version != PROTOCOL_VERSION {
        bail!(
            "the running Agent speaks protocol v{}, but this CLI requires v{PROTOCOL_VERSION}; \
             update or restart OpenLogi so both processes match (no profile was written)",
            connection.version
        );
    }

    tokio::time::timeout(
        DECLARE_TIMEOUT,
        connection
            .client
            .declare_client(context::current(), ClientKind::Cli),
    )
    .await
    .map_err(|_| anyhow!("the running Agent timed out before semantic capture could begin"))?
    .map_err(|_| anyhow!("the running Agent disconnected before semantic capture could begin"))?;

    let snapshot = tokio::time::timeout(
        SNAPSHOT_TIMEOUT,
        connection.client.snapshot(context::current()),
    )
    .await
    .map_err(|_| anyhow!("the running Agent timed out while providing its device snapshot"))?
    .map_err(|_| anyhow!("the running Agent disconnected while providing its device snapshot"))?;

    let captured = capture_profile(&connection.client, snapshot, selector, id, name).await?;
    captured
        .profile
        .validate()
        .context("captured semantic profile failed version-1 validation; no profile was written")?;
    Ok(captured)
}

fn validate_metadata(args: &RecordProfileArgs) -> Result<()> {

View on GitHub (pinned to e846e6f4b4)