zeroclaw-labs/zeroclaw · error

Refusing to replace JSONL session created while {} was stage

Error message

Refusing to replace JSONL session created while {} was staged

What it means

Error "Refusing to replace JSONL session created while {} was staged" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at crates/zeroclaw-infra/src/session_sqlite.rs:323

        let _ = path;
        Ok(())
    }

    fn sync_staged_jsonl(path: &Path, name: &str) -> Result<()> {
        let mut options = std::fs::OpenOptions::new();
        options.read(true);
        #[cfg(windows)]
        options.write(true);
        options
            .open(path)
            .with_context(|| format!("Failed to open staged JSONL session {name} for sync"))?
            .sync_all()
            .with_context(|| format!("Failed to sync staged JSONL session {name}"))
    }

    fn restore_uncommitted_jsonl(staged_path: &Path, live_path: &Path) -> Result<()> {
        if live_path.exists() {
            bail!(
                "Refusing to replace JSONL session created while {} was staged",
                live_path.display()
            );
        }
        std::fs::rename(staged_path, live_path).with_context(|| {
            format!(
                "Failed to restore empty JSONL session {}",
                live_path.display()
            )
        })
    }

    fn import_receipt(
        conn: &Connection,
        source_name: &str,
    ) -> Result<Option<(String, String, i64)>> {
        conn.query_row(
            "SELECT session_key, source_hash, source_len FROM jsonl_import_receipts \

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Resolve the staged SQLite state first (complete or roll back the migration), then recreate the JSONL session.

When it happens

Trigger: Thrown at crates/zeroclaw-infra/src/session_sqlite.rs:323 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/70be7366cf1a6512. Report an issue: GitHub.