BigPizzaV3/CodexPlusPlus · critical · anyhow::Error

启动静默入口失败: ;回滚 live 配置也失败:

Error message

启动静默入口失败:{error};回滚 live 配置也失败:{restore_error}

What it means

Thrown when the spawned launch process (the silent launcher entry) fails via spawn(request), and restoring the previously captured RelayLiveSnapshot of the live config also fails during cleanup. The message carries both the original launch error and the restore error, indicating the live config may be left in the pre-launch (but not guaranteed-original) state.

Solutions

  1. Read the embedded {error} — fix the underlying launch failure first (e.g. ensure the launcher binary exists and is executable).
  2. Manually verify/restore config.toml since automatic restore failed; check for locks on the file.
  3. Check filesystem permissions and disk space in the Codex home directory.
  4. Retry the launch after closing other Codex/manager processes that may hold config.toml.

Example fix

// before: spawn fails and rollback fails, config possibly inconsistent
// after: pre-check launcher availability before sync
if !launcher_binary_exists() {
    return Err(anyhow::anyhow!("launcher binary missing; skipping live sync"));
}
let snapshot = RelayLiveSnapshot::capture(home)?;
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check before sync+spawn
if !PathBuf::from(launcher_path).exists() {
    return Err(anyhow::anyhow!("launcher binary missing"));
}
let snapshot = RelayLiveSnapshot::capture(home)?;

Type guard

fn snapshot_restorable(snapshot: &Option<RelayLiveSnapshot>, home: &Path) -> bool {
    snapshot.as_ref().map(|s| s.can_restore(home)).unwrap_or(true)
}

Try / catch

if let Err(error) = spawn(request) {
    if let Err(restore_error) = snapshot.map(|s| s.restore(home)) {
        eprintln!("launch failed: {error}; restore also failed: {restore_error:?} — repair config.toml manually");
    }
    return Err(error);
}

Prevention

When it happens

Trigger: Calling a launch command (commands.rs) after a successful sync_active_relay_to_home, where spawn(request) returns Err (launcher binary missing, port conflict, exec failure) and snapshot.restore(home) then errors (config.toml write failure, permissions, IO).

Common situations: Launcher executable not found or not built; antivirus/permissions blocking process spawn; config.toml locked by another process so restore cannot write back.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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

Appendix: source

Thrown at apps/codex-plus-manager/src-tauri/src/commands.rs:957

    F: FnOnce(&LaunchRequest) -> anyhow::Result<()>,
{
    let snapshot = if let Some(settings) = settings {
        let snapshot = RelayLiveSnapshot::capture(home)?;
        if let Err(error) = sync_active_relay_to_home(settings, home) {
            if let Err(restore_error) = snapshot.restore(home) {
                anyhow::bail!("同步当前供应商失败:{error};回滚 live 配置也失败:{restore_error}");
            }
            return Err(error);
        }
        Some(snapshot)
    } else {
        None
    };

    if let Err(error) = spawn(request) {
        if let Some(snapshot) = snapshot {
            if let Err(restore_error) = snapshot.restore(home) {
                anyhow::bail!("启动静默入口失败:{error};回滚 live 配置也失败:{restore_error}");
            }
        }
        return Err(error);
    }
    Ok(())
}

#[derive(Debug)]
struct RelayLiveSnapshot {
    config: Option<Vec<u8>>,
    auth: Option<Vec<u8>>,
}

impl RelayLiveSnapshot {
    fn capture(home: &Path) -> anyhow::Result<Self> {
        Ok(Self {
            config: read_optional_file_bytes(&home.join("config.toml"))?,
            auth: read_optional_file_bytes(&home.join("auth.json"))?,

View on GitHub (pinned to b1ed92e5e4)