Skip to content

Feature 'useRememberedArgumentsForUpgrades' not respected when upgrading Chocolatey components through dependency chain #3840

@gep13

Description

@gep13

Checklist

  • I confirm there are no unresolved issues reported on the Chocolatey Status page.
  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.
  • I confirm I am using official, and not unofficial, or modified, Chocolatey products.

What You Are Seeing?

When useRememberedArgumentsForUpgrades is enabled, Chocolatey has trouble handling any remembered arguments for packages that it upgrades through dependency resolution. I've seen this occur twice:

  • When upgrading chocolatey.extension, if the chocolatey-agent package is upgraded through dependency resolution, it will ignore any remembered arguments for chocolatey-agent.
  • When upgrading chocolatey-agent, if the chocolatey.extension is upgraded through dependency resolution, it will ignore any remembered arguments for 'chocolatey.extension`.

Moreover, when a package that has remembered arguments is upgraded through dependency resolution, any remembered arguments from the package that was upgraded directly are copied over to the other package. Example:

The 'chocolatey.extension' package has:

 Remembered Package Arguments:
  --package-parameters='/NoContextMenu'

The chocolatey-agent package has:

 Remembered Package Arguments:
  --package-parameters='/Username:Local System'

When running choco upgrade chocolatey-agent -y per our recommended upgrade order, Chocolatey will not only ignore the remembered arguments for the chocolatey.extension package, it will copy the remembered arguments from the chocolatey-agent package onto the chocolatey.extension package, which is then reflected in the outputs from running choco info against both packages.

An additional curiosity is that, when --force is used during an upgrade, it adds --allow-downgrade to the remembered arguments of the upgraded package. This was found by accident when creating the replication steps.

What is Expected?

Chocolatey should gracefully handle any remembered arguments for any packages that are upgraded, either directly or through dependency resolution.

How Did You Get This To Happen?

  1. Install chocolatey 2.5.1.
  2. Enable the useRememberedArgumentsForUpgrades feature:
  • choco feature enable --name='useRememberedArgumentsForUpgrades'
  1. License the machine with a Chocolatey license, and ensure that the chocolatey.licensed source is enabled.
  2. Run the following command to install the Chocolatey Licensed Extension without context menus:
  • choco install chocolatey.extension -y --version=6.3.1 --package-parameters="'/NoContextMenu'"
  1. Run the following command to install the Chocolatey Agent using the Local System account as its preferred account:
  • choco install chocolatey-agent -y --version='2.3.0' --package-parameters="'/Username:Local System'"
  1. Upgrade the Chocolatey Agent per the recommended upgrade order of chocolatey-agent, chocolatey.extension, and chocolatey.
  2. Confirm the copying of the parameters from the chocolatey-agent package to the information output when running choco info chocolatey.extension --local-only.

System Details

  • Operating System: Windows 11
  • Windows PowerShell Version: 5.1
  • Chocolatey CLI Version: 2.5.1
  • Chocolatey Licensed Extension version: 6.3.1
  • Chocolatey License type (Professional / Business / ?): BusinessTrial
  • Terminal/Emulator: Windows PowerShell

Installed Packages

N/A

Output Log

PowerShell Output

//PS C:\Users\Chris> choco
choco : The term 'choco' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ choco
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\Chris> #Set the chocolateyVersion environment variable to the requested version
PS C:\Users\Chris> $env:chocolateyVersion = '2.5.1'
PS C:\Users\Chris>
PS C:\Users\Chris> #Run the regular Chocolatey Installation PowerShell command
PS C:\Users\Chris> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Downloading specific version of Chocolatey: 2.5.1
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.5.1.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.5.1 to C:\Users\Chris\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\Chris\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\Chris\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey CLI folders if they do not already exist.

chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\Chris\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey CLI (choco.exe) is now ready.
You can call choco from anywhere, command line or PowerShell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart PowerShell and/or consoles
 first prior to using choco.
Ensuring Chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
PS C:\Users\Chris> choco feature enable --name= 'useRememberedArgumentsForUpgrades'
Chocolatey v2.5.1
Enabled useRememberedArgumentsForUpgrades
PS C:\Users\Chris> choco install chocolatey.extension -y --version=6.3.1 --package-parameters="'/NoContextMenu'"
A valid Chocolatey license was found, but the chocolatey.licensed.dll assembly could not be loaded:
  Unable to load licensed assembly.
Ensure that the chocolatey.licensed.dll exists at the following path:
 'C:\ProgramData\chocolatey\extensions\chocolatey\chocolatey.licensed.dll'
To resolve this, install the Chocolatey Licensed Extension package with
 `choco install chocolatey.extension`
Chocolatey v2.5.1 BusinessTrial
Installing the following packages:
chocolatey.extension
By installing, you accept licenses for the packages.
Downloading package from source 'https://licensedpackages.chocolatey.org/api/v2/'
Progress: Downloading chocolatey.extension 6.3.1... 100%

chocolatey.extension v6.3.1
chocolatey.extension package files install completed. Performing other installation steps.
Removing right-click context menus, if they exist.
 ShimGen has successfully created a shim for packagebuilder.exe
 ShimGen has successfully created a shim for packageuploader.exe
 Installed/updated chocolatey extensions.
 The install of chocolatey.extension was successful.
  Deployed to 'C:\ProgramData\chocolatey\extensions\chocolatey'

Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Users\Chris> choco install chocolatey-agent -y --version='2.3.0' --package-parameters="'/Username:Local System'"
Chocolatey v2.5.1 BusinessTrial
Installing the following packages:
chocolatey-agent
By installing, you accept licenses for the packages.
Downloading package from source 'https://licensedpackages.chocolatey.org/api/v2/'
Progress: Downloading chocolatey-agent 2.3.0... 100%

chocolatey-agent v2.3.0
chocolatey-agent package files install completed. Performing other installation steps.
Installing Windows service named 'chocolatey-agent' pointing to 'C:\ProgramData\chocolatey\lib\chocolatey-agent\tools\service\chocolatey-agent.exe'...
Installing service chocolatey-agent...
Service chocolatey-agent has been successfully installed.
Creating EventLog source chocolatey-agent in log Application...
Windows service named 'chocolatey-agent' successfully installed.
Starting Windows service named 'chocolatey-agent' if it is not running...
 The install of chocolatey-agent was successful.
  Software install location not explicitly set, it could be in package or
  default install location of installer.

Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Users\Chris> choco upgrade chocolatey-agent -y
Chocolatey v2.5.1 BusinessTrial
Upgrading the following packages:
chocolatey-agent
By upgrading, you accept licenses for the packages.

You have chocolatey-agent v2.3.0 installed. Version 3.0.0 is available based on your source(s).
Downloading package from source 'https://licensedpackages.chocolatey.org/api/v2/'

chocolatey v2.6.0
chocolatey package files upgrade completed. Performing other installation steps.
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey CLI folders if they do not already exist.

WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\Chris\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey CLI (choco.exe) is now ready.
You can call choco from anywhere, command line or PowerShell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart PowerShell and/or consoles
 first prior to using choco.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The upgrade of chocolatey was successful.
  Software install location not explicitly set, it could be in package or
  default install location of installer.
Downloading package from source 'https://licensedpackages.chocolatey.org/api/v2/'
Progress: Downloading chocolatey.extension 7.0.0... 100%

chocolatey.extension v7.0.0
chocolatey.extension package files upgrade completed. Performing other installation steps.
Adding Package Builder context menu for supported types.
 ShimGen has successfully created a shim for packagebuilder.exe
 ShimGen has successfully created a shim for packageuploader.exe
 Installed/updated chocolatey extensions.
 The upgrade of chocolatey.extension was successful.
  Deployed to 'C:\ProgramData\chocolatey\extensions\chocolatey'
Stopping Windows service named 'chocolatey-agent' if it is running...
Downloading package from source 'https://licensedpackages.chocolatey.org/api/v2/'
Progress: Downloading chocolatey-agent 3.0.0... 100%

chocolatey-agent v3.0.0
chocolatey-agent package files upgrade completed. Performing other installation steps.
Stopping Windows service named 'chocolatey-agent' if it is running...
Uninstalling service named 'chocolatey-agent'...
Removing EventLog source chocolatey-agent.
Service chocolatey-agent is being removed from the system...
Service chocolatey-agent was successfully removed from the system.
Installing Windows service named 'chocolatey-agent' pointing to 'C:\ProgramData\chocolatey\lib\chocolatey-agent\tools\service\chocolatey-agent.exe'...
Installing service chocolatey-agent...
Service chocolatey-agent has been successfully installed.
Creating EventLog source chocolatey-agent in log Application...
Windows service named 'chocolatey-agent' successfully installed.
Starting Windows service named 'chocolatey-agent' if it is not running...
 The upgrade of chocolatey-agent was successful.
  Software install location not explicitly set, it could be in package or
  default install location of installer.

Chocolatey upgraded 3/3 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Users\Chris> choco info chocolatey.extension --local-only
Chocolatey v2.6.0 BusinessTrial
chocolatey.extension 7.0.0
 Title: Chocolatey Licensed Extension | Published: 12/17/2025
 Number of Downloads:  | Downloads for this version:
 Package url
 Chocolatey Package Source: n/a
 Tags: chocolatey extension licensed professional business enterprise architect
 Software Site: https://chocolatey.org/
 Software License: n/a
 Summary: Chocolatey Licensed Extension - brings licensed features to Chocolatey!
 Description: Chocolatey Licensed Extension - brings licensed features to Chocolatey!

  There are a few different editions of Chocolatey Licensed, please see https://chocolatey.org/pricing (and click on [compare editions](https://chocolatey.org/pricing#compare)) to review the options and features available for each edition.

  While Chocolatey FOSS (Open Source) is about package management, Chocolatey for Business (C4B) is moving towards complete software management. Chocolatey Pro and MSP are somewhere in between and Architect for DevOps consultants who build packaging for other organizations.

  ### Package Specific
  #### Package Parameters
  The following package parameters can be passed:

   * `/NoContextMenu` - Doesn't add the context menus (or removes existing context menus) for tools like Package Builder / Package Uploader during install/upgrade with C4B/Architect. Defaults to unset.

  To pass parameters, use `--params "''"` (e.g. `choco install packageID [other options] --params="'/ITEM:value /ITEM2:value2 /FLAG_BOOLEAN'"`).
  To have choco remember parameters on upgrade, be sure to set `choco feature enable -n=useRememberedArgumentsForUpgrades`.
 Release Notes: See all - https://docs.chocolatey.org/en-us/licensed-extension/release-notes
 Deployed to: 'C:\ProgramData\chocolatey\extensions\chocolatey'
 Remembered Package Arguments:
  --package-parameters='/Username:Local System'
  --cache-location='C:\Users\Chris\AppData\Local\Temp\chocolatey'

1 packages installed.
PS C:\Users\Chris>

Acceptance Criteria

  • The steps to reproduce the bug above are tested and known to work correctly with the change in place
  • When packages are installed as dependencies, the correct arguments are persisted into each packages .arguments file
  • Any additional command line arguments that are provided when upgrading the package should be added to any additional ones that were previously persisted into the .arguments file
  • Any additional command line arguments that are provided during the upgrade should not be persisted to the .arguments file. If the user wants these arguments used in all cases, the new command for managing arguments should be used
  • Any arguments given at the command line should take precedence over those that are stored within the .arguments file

Additional Context

This issue was created based on a discussion that was had on an internal issue here.

In addition, a follow up issue to allow the management of remembered arguments has been created here.

┆Issue is synchronized with this Clickup task by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    0 - BacklogIssue is accepted, but is not ready to be worked on or not in current sprint.BugIssues where something has happened which was not expected or intended.ClickUp - BacklogUsed when syncing issues between GitHub and Clickup.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions