BigPizzaV3/CodexPlusPlus · error · anyhow::Error

Session file import is unavailable

Error message

Session file import is unavailable

What it means

import_session_file mirrors export_session_file: it raises the sentinel 'Session file import is unavailable' because the concrete BridgeDataService in this route context does not implement session-file import. The request reached a handler whose data service lacks the capability.

Solutions

  1. Use a backend that overrides import_session_file
  2. Handle the error as an unsupported-feature case
  3. Hide the import option when the backend lacks support

Example fix

// before
store.import_session_file(payload).await?;
// after
if let Err(e) = store.import_session_file(payload).await {
    if e.to_string().contains("unavailable") { notify_unsupported(); return Ok(()); }
    return Err(e.into());
}
Defensive patterns

Strategy: fallback

Try / catch

match store.import_session_file(payload).await {
    Ok(v) => reload_sessions(v),
    Err(e) if e.to_string().contains("unavailable") => show_unsupported_message(),
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling import_session_file on a backend that does not override the default method.

Common situations: Attempt to import a previously exported session file against a minimal/fallback backend; tests hitting the trait default.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/ce7037d4e67f4d8d. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/routes.rs:126

#[async_trait]
pub trait BridgeDataService: Send + Sync {
    async fn delete(&self, session: SessionRef) -> anyhow::Result<DeleteResult>;
    async fn undo(&self, undo_token: String) -> anyhow::Result<DeleteResult>;
    async fn export_markdown(&self, session: SessionRef) -> anyhow::Result<ExportResult>;
    async fn thread_usage_history(&self, session: SessionRef) -> anyhow::Result<Value>;
    async fn find_archived_thread_by_title(
        &self,
        title: String,
    ) -> anyhow::Result<Option<SessionRef>>;
    async fn recover_remote_control_session(&self, _thread_id: String) -> anyhow::Result<Value> {
        anyhow::bail!("Remote Control session recovery is unavailable")
    }
    async fn export_session_file(&self, _session: SessionRef) -> anyhow::Result<Value> {
        anyhow::bail!("Session file export is unavailable")
    }
    async fn import_session_file(&self, _payload: Value) -> anyhow::Result<Value> {
        anyhow::bail!("Session file import is unavailable")
    }
}

pub async fn handle_bridge_request(
    ctx: BridgeContext,
    path: &str,
    payload: Value,
) -> serde_json::Value {
    let started = Instant::now();
    let _ = crate::diagnostic_log::append_diagnostic_log(
        "bridge.request",
        json!({
            "path": path,
            "payload_keys": payload
                .as_object()
                .map(|object| object.keys().cloned().collect::<Vec<_>>())
                .unwrap_or_default()
        }),

View on GitHub (pinned to b1ed92e5e4)