Skip to content

Snippet XML import dialog shows snippets but fails to actually import them (Windows) #2103

@ultraleetj

Description

@ultraleetj

Environment:

  • OS: Windows 11, though I would presume all of them given your typical apathy for win users.
  • Frescobaldi version: 4.0.4 (August 2025)

Bug Description:

The snippet XML import feature fails silently on Windows. When importing snippets via the Snippet Manager Menu→Import:

  1. The import dialog opens correctly
  2. The XML file is parsed successfully and snippets are displayed in the dialog
  3. User selects snippets and clicks OK
  4. Dialog closes with no error message or anything,
  5. No snippets are actually added to the snippet manager

The dialog appears to work correctly but performs no actual import operation.

Steps to Reproduce:

  1. Export any existing snippet to XML (Menu→Export)
  2. Delete the snippet from the snippet manager
  3. Attempt to re-import the snippet via Menu→Import
  4. Select the snippet in the dialog and click OK
  5. Observe that the snippet does not appear in the snippet manager

Root Cause:

Turns out that Frescobaldi depressingly stores snippets in the Windows Registry at:
HKEY_CURRENT_USER\Software\frescobaldi\frescobaldi\snippets
or even
HKEY_USERS\Software\frescobaldi\frescobaldi\snippets
Given this, whats most likely, is that the import function appears to fail when writing multi-line string values (REG_SZ) to the registry. This is a known Windows limitation where multi-line REG_SZ values exported from the registry cannot be re-imported from .reg files - they must be encoded in hex(1) format for import to work.

Why This Is Problematic:

Storing user-editable content like snippets in the Windows Registry is already questionable design practice. It makes the data:

  • Non-portable (can't easily copy between machines)
  • Difficult to backup
  • Harder to version control
  • Inaccessible in locked-down enterprise/school environments

But what makes this particularly frustrating is that the XML import/export feature was presumably created to solve these exact problems - yet it doesn't actually work on Windows. So Windows users are stuck with the worst of both worlds: registry-based storage without the ability to import/export snippets that the feature promises.

It's especially ironic given that LilyPond itself is all about human-readable plain text files, yet Frescobaldi chose to store snippets in the Windows Registry - the antithesis of plain text. And when Windows users encounter issues stemming from this architectural choice, they're often met with "works fine on Linux" responses. Well, yes - Linux doesn't use the Windows Registry, so it avoids this entire class of problems.

The "install for current user only" option suggests Frescobaldi doesn't need admin/registry access, which makes the registry storage choice even more puzzling.

Workarounds:

Option 1 (Immediate fix): On Windows, use the Windows Registry API (via ctypes/winreg in Python) or PowerShell via subprocess to write registry values directly instead of generating/importing .reg files. This avoids the multi-line limitation entirely.
Option 2 (Better long-term solution): Store snippets in XML/JSON files in %APPDATA%\frescobaldi\snippets\ instead of the Windows Registry.

Additional Notes:
This bug affects Windows 7, 10, and 11 (likely all Windows versions) as it's a limitation of the Windows Registry Editor's .reg file format, not a specific Windows version issue.
The XML export feature works correctly - only import is affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions