Skip to content

export-notes-json silently drops/duplicates notes with identical titles #115

Description

@draku

Description

export-notes-json silently drops notes when two or more notes in the same account/folder share an exact title. Instead of exporting each distinct note, it exports one of them repeated N times (same id, same content) and the other N-1 notes are missing entirely, with no error or count mismatch.

Steps to Reproduce

  1. Create two notes with the identical title, e.g. "Review later", in the same folder.
  2. Run export-notes-json.
  3. Inspect the export: both entries for "Review later" have the same id and content.

Expected Behavior

The export contains one entry per distinct note, each with its own correct id and content, regardless of title collisions.

Actual Behavior

exportNotesAsJson() lists note titles per folder, then re-fetches each note a second time by title (getNoteDetails(title, account) / getNoteContent(title, account)). AppleScript's note "<name>" specifier resolves an ambiguous (duplicated) name deterministically to the same one note every time, so every loop iteration for a title with N duplicates re-fetches the same underlying note. The bulk listing one call earlier already dedups correctly by id and knows there are N distinct notes, but only titles survive into the export loop, so that information is lost.

Real examples observed: "Rust Package Registry" (8 distinct notes → 1 id repeated ~7 times, 7 missing), "New Note" (4 distinct notes → 1 repeated, 3 missing), "Review later" (2 distinct notes → 1 repeated, 1 missing).

Environment

  • apple-notes-mcp version: 2.6.11

Additional Context

Root cause and fix direction: src/services/appleNotesManager.ts, exportNotesAsJson(). The ids are already available from the bulk AppleScript listing (parseBulkListOutput) but discarded before reaching the export loop. Re-fetching by id (getNoteById / getNoteContentById) instead of by title — the same pattern search-notes and deleteNoteById already use — removes the ambiguous lookup entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions