zeroclaw-labs/zeroclaw · error

Refusing ambiguous JSONL migration with both

Error message

Refusing ambiguous JSONL migration with both {} and {}

What it means

Safety refusal during JSONL migration: for one candidate session, both the live file and its .importing staged copy exist at the same time, so it is ambiguous which one represents committed state. Rather than guessing and risking data loss, migrate_from_jsonl_with_handlers aborts and names both paths in the message.

Solutions

  1. Remove one of the two conflicting JSONL files so migration is unambiguous, then retry.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-infra/src/session_sqlite.rs:514 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/5a0be12b5eaccf9d. Report an issue: GitHub.

Appendix: source

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

                .expect("candidate suffix checked")
                .to_owned();
            candidates.push((
                source_name.clone(),
                key,
                sessions_dir.join(&source_name),
                sessions_dir.join(format!("{source_name}.importing")),
                sessions_dir.join(format!("{source_name}.migrated")),
                staged,
            ));
        }
        candidates.sort_by(|left, right| right.5.cmp(&left.5).then(left.0.cmp(&right.0)));

        let mut migrated = 0;
        for (name, key, live_path, staged_path, migrated_path, staged) in candidates {
            let candidate_may_have_committed_receipt = staged && has_committed_import;
            if staged {
                if live_path.exists() {
                    bail!(
                        "Refusing ambiguous JSONL migration with both {} and {}",
                        live_path.display(),
                        staged_path.display()
                    );
                }
            } else {
                if staged_path.exists() {
                    bail!(
                        "Refusing ambiguous JSONL migration with both {} and {}",
                        live_path.display(),
                        staged_path.display()
                    );
                }
                if migrated_path.exists() {
                    bail!(
                        "Refusing to replace existing migrated JSONL session {}",
                        migrated_path.display()
                    );

View on GitHub (pinned to 88bb9c8533)