tinyhumansai/openhuman · error · anyhow::Error

Backend returned {status} for DELETE {url}: {detail}

Error message

Backend returned {status} for DELETE {url}: {detail}

What it means

raw_delete (shared by delete_connection and disable_trigger) checks the HTTP status of the DELETE against /agent-integrations/composio/...; any non-2xx bails with the status code, URL, and extracted detail body. The site first routes the failure through the observability classifier, so user-state 4xx (toolkit not enabled, trigger not found, missing fields) demote to breadcrumbs while 5xx and other 4xx stay actionable Sentry events.

Source

Thrown at src/openhuman/integrations/composio/client.rs:545

                status,
                logged_body
            );
            let status_str = status.as_u16().to_string();
            // Mirrors the integrations post()/get() sites — see
            // OPENHUMAN-TAURI-BC. 4xx user-input / auth-state shapes
            // demote via the observability classifier; 5xx and
            // non-transient 4xx still surface as actionable events.
            crate::core::observability::report_error_or_expected(
                format!("Backend returned {status} for DELETE {url}: {detail}").as_str(),
                "composio",
                "delete",
                &[
                    ("path", path),
                    ("status", status_str.as_str()),
                    ("failure", "non_2xx"),
                ],
            );
            anyhow::bail!("Backend returned {status} for DELETE {url}: {detail}");
        }

        let envelope: Envelope<T> = resp.json().await?;
        if !envelope.success {
            let msg = envelope
                .error
                .unwrap_or_else(|| "unknown backend error".into());
            // Mirrors the integrations envelope-error sites — route through
            // the observability classifier so user-state envelope failures
            // (composio "Toolkit X is not enabled" / "Trigger type …
            // not found" / "Missing required fields: …" — OPENHUMAN-TAURI-3R
            // / -3S / -34 / -97) demote to a breadcrumb instead of firing
            // a Sentry event. Genuine backend bugs still surface.
            crate::core::observability::report_error_or_expected(
                msg.as_str(),
                "composio",
                "delete",
                &[("path", path), ("failure", "envelope_error")],

View on GitHub (pinned to 7491200858)

Solutions

  1. Read the status and {detail} suffix — they name the exact backend reason for the failed DELETE
  2. Treat 404 as success when the goal is ensure-deleted (idempotent delete), since the end state is what you wanted
  3. Refresh the connection/trigger list before offering delete actions so stale ids are not used
  4. For 401, re-establish the session and retry once; for 5xx, retry with backoff

Example fix

// before
client.delete_connection(id).await?;

// after — treat already-deleted as success
match client.delete_connection(id).await {
    Ok(resp) => Ok(resp),
    Err(err) if err.to_string().contains("404") => Ok(ComposioDeleteResponse::default()),
    Err(err) => Err(err),
}
Defensive patterns

Strategy: try-catch

Try / catch

match client.disable_trigger(trigger_id).await {
    Ok(resp) => Ok(resp),
    Err(err) => {
        let msg = err.to_string();
        if msg.contains(" 404 ") || msg.contains(" 410 ") {
            Ok(ComposioDisableTriggerResponse::default()) // already gone — treat as deleted
        } else if msg.contains(" 401 ") {
            reauth_and_retry_delete(trigger_id).await
        } else {
            Err(err) // 403 / 5xx — surface to the user
        }
    }
}

Prevention

When it happens

Trigger: DELETE of a connection/trigger id that does not exist or was already deleted (404), a connection owned by another user (403), an expired session (401), or a backend 5xx. The URL and detail in the message identify which resource failed.

Common situations: Double-delete from a double-clicking UI or a retried request; deleting from a stale list after the resource vanished; concurrent deletion from another device/session.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/e6542154dead6206. Report an issue: GitHub.