Skip to content

Fix: unregistered print.browser.useAlternate configuration error on startup#432

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-print-browser-configuration
Draft

Fix: unregistered print.browser.useAlternate configuration error on startup#432
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-print-browser-configuration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 10, 2026

Users who had passed through an intermediate version of the extension had print.browser.useAlternate and/or print.browser.alternateBrowserPath written to their settings.json. These keys were removed from package.json in a later refactoring, causing VS Code to error on every startup when encountering them.

Changes

  • package.json: Register print.browser.useAlternate (boolean) and print.browser.alternateBrowserPath (string) as deprecated settings with deprecationMessage pointing to the current key names. This prevents VS Code from rejecting reads/writes to these keys on behalf of users still carrying them.

  • src/settings-migration.ts:

    • Fix migration map: "alternateBrowser" now maps directly to "alternateBrowser.enable" (was "browser.useAlternate", an intermediate unregistered step); same for "browserPath""alternateBrowser.path".
    • Fix getSourceKeys(): previously excluded any key that was itself a migration target — this silently skipped browser.useAlternate and browser.alternateBrowserPath, leaving them stranded in settings. Now returns all non-self-referential keys so intermediate keys are also migrated and cleaned up.
    • Remove resolveMigrationChain(): no longer needed since all mappings are now direct.
    • Separate deletion into its own try/catch so a failed cleanup of an unregistered old key doesn't roll back a successful write to the new key.
  • src/extension.ts: Fix typo in setAlternateBrowser()"print.alternatBrowser""print.alternateBrowser" (missing e would write to an unregistered key).

Original prompt

This section details on the original issue you should resolve

<issue_title>Bug: print.browser.useAlternate is not a registered configuration</issue_title>
<issue_description>Starting vs code with code . with pdconsec.vscode-print installed emits on extension host output the following error.

2025-09-17 14:22:16.724 [error] CodeExpectedError: Unable to write to User Settings because print.browser.useAlternate is not a registered configuration.
    at Y1t.z (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3677:6793)
    at Y1t.F (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3677:9281)
    at Y1t.o (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3677:3874)
    at Object.factory (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3677:3774)
    at _v.j (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:30:75818)
    at vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:30:75730
    at new Promise (<anonymous>)
    at _v.queue (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:30:75672)
    at Y1t.writeConfiguration (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3677:3743)
    at ofn.Hb (vscode-file://vscode-app/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:3677:42740)

If uninstalling, this disappears. </issue_description>

<agent_instructions>Refactoring means some code is trying to use setting names that don't match the names in package.json contributions section. The problem is that you won't find these as a simple string match, you'll have to look for permutations of the same name that are conceptually equivalent then match the convention for other settings and finally align all the code.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@DavidRawling This looks like it's caused by a recent refactoring of the settings - it's cosmetic (or should be) - it's on the list for a fix (by which I mean we've already sorted it in the development branches), but releases of cosmetic fixes are going to be delayed a little by personal circumstances.

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: PeterWone <5498936+PeterWone@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error for print.browser.useAlternate configuration Fix: unregistered print.browser.useAlternate configuration error on startup Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: print.browser.useAlternate is not a registered configuration

2 participants