Hmbown/CodeWhale · error

legacy import left rejected notes unchanged; inspect before…

Error message

legacy import left {} rejected notes unchanged; inspect before retry

What it means

During import of notes from the legacy (pre-structured) memory store, some notes failed validation and were rejected by the structured store's note importer. Because a partial import would silently drop data, the function aborts with this error, leaving all notes unimported so the failure can be inspected before retrying. It is a deliberate fail-loud guard against data loss.

Solutions

  1. Inspect the legacy store contents to find the note(s) that fail validation (rejected count is in the message).
  2. Fix or remove the offending legacy notes, then re-run import_legacy.
  3. If upgrading across versions, check the changelog for tightened note validation rules and migrate notes accordingly.
  4. Import into a fresh structured store location to rule out conflicts with existing data.

Example fix

// before
import_legacy(&store)?; // aborts: legacy import left 3 rejected notes unchanged
// after
// prune or repair invalid legacy notes first, then retry
let report = import_legacy(&store)?;
assert!(report.rejected.is_empty());
Defensive patterns

Strategy: validation

Validate before calling

let report = store.dry_run_import_legacy(&legacy_notes)?;
if !report.rejected.is_empty() {
    eprintln!("fix {} rejected legacy notes before importing", report.rejected.len());
}

Try / catch

match import_legacy(&store) {
    Ok(_) => {},
    Err(e) if e.to_string().contains("rejected notes unchanged") => inspect_and_repair_legacy_notes(),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling import_legacy when at least one legacy note fails the structured store's write/import validation (e.g. a note violates size limits, encoding, or scope rules), producing a non-empty report.rejected.

Common situations: Migrating an old ~/.codewhale-style memory file that contains notes no longer accepted by the current store format; corrupt or oversized legacy notes; schema changes between versions that tightened note validation.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/1ea1ade3f59fa60a. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/native_memory.rs:520

            return Ok(false);
        }
        let meta = fs::symlink_metadata(path)?;
        if meta.file_type().is_symlink() || meta.len() > 1024 * 1024 {
            bail!("legacy import refused: symlink or size bound");
        }
        let text = fs::read_to_string(path)?;
        let scope = Self::owner_scope();
        let access = Access::operator(vec![scope.clone()])?;
        let mut store = self.open_structured()?;
        let report = codewhale_memory::import::markdown(
            &mut store,
            &access,
            &scope,
            "codewhale:legacy-memory",
            &text,
        )?;
        if !report.rejected.is_empty() {
            bail!(
                "legacy import left {} rejected notes unchanged; inspect before retry",
                report.rejected.len()
            );
        }
        Ok(report.created > 0)
    }
    pub fn export(&self) -> Result<String> {
        let store = self.open_structured()?;
        let owner = Access::operator(vec![Self::owner_scope()])?;
        let scopes = store.local_scope_inventory(&owner)?;
        let mut output = String::from(
            "# CodeWhale memory export\n\nNot an instruction file. This Markdown is not authoritative.\n",
        );
        for scope in scopes {
            let access = Access::operator(vec![scope])?;
            let mut after = None;
            loop {
                let batch = store.list(&access, after.as_deref(), 500)?;

View on GitHub (pinned to 73e0f67d83)