chocolatey / chocolatey/choco

Using Packages.config with sources specified in the config file fails if all global sources are disabled.

Open
#3,664 2 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [x] I confirm there are no unresolved issues reported on the [Chocolatey Status page](https://status.chocolatey.org).
- [x] I have verified this is the correct repository for opening this issue.
- [x] I have verified no other issues exist related to my problem.
- [x] I have verified this is not an issue for a specific package.
- [x] I have verified this issue is not security related.
- [x] I confirm I am using **official**, and **not** unofficial, or modified, Chocolatey products.

### What You Are Seeing?

If we create a packages.config containing references to several packages on the local filesystem (as in, has the source="c:\path\to\package.nupkg" set for every entry), and we run
`choco install path\to\packages.config -y --pre `
while all global sources are disabled, then chocolatey fails with the following error, unexpectedly.
`Installation was NOT successful. There are no sources enabled for
packages, and none were passed as arguments.`
While the error is technically correct (we didn't supply any sources), they are provided in the packages.config explicitly.
As a workaround, we can supply --source="path\to\packages" and it works, but we shouldn't need to do this.

### What is Expected?

Installation of the packages listed in packages.config completes successfully when all of them, and their dependencies, are explicitly listed with sources="path\to\nupkg" values set.

### How Did You Get This To Happen?

1. I used `choco source disable -n=chocolatey` to disable the default global source
2. I created a packages.config that listed one or more packages, with source="pathname" set explicitly to local packages on the filesystem
3. I ran `choco install packages.config -y --pre`
4. I observed the error `Installation was NOT successful. There are no sources enabled for packages, and none were passed as arguments.`

### System Details

* Operating System: Windows 11, 24h2 (also seen on win10 1809 LTS)
* Windows PowerShell version: 5 1 17763 5820
* Chocolatey CLI Version: 2.4.3
* Chocolatey Licensed Extension version: n/a
* Chocolatey License type: free
* Terminal/Emulator: cmd.exe

### Installed Packages

```bash
chocolatey|2.4.3
```

### Output Log

```bash
2025-05-08 11:04:54,572 72320 [INFO ] - Chocolatey v2.4.3
2025-05-08 11:04:54,582 72320 [DEBUG] - Chocolatey is running on Windows v 10.0.26100.0
2025-05-08 11:04:54,582 72320 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2025-05-08 11:04:54,582 72320 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2025-05-08 11:04:54,582 72320 [DEBUG] - Command line not shown - sensitive arguments may have been passed.
2025-05-08 11:04:54,611 72320 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2025-05-08 11:04:54,617 72320 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2025-05-08 11:04:54,621 72320 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2025-05-08 11:04:54,648 72320 [DEBUG] - Performing validation checks.
2025-05-08 11:04:54,650 72320 [DEBUG] - Global Configuration Validation Checks:
2025-05-08 11:04:54,652 72320 [DEBUG] - - Package Exit Code / Exit On Reboot = Checked
2025-05-08 11:04:54,654 72320 [DEBUG] - System State Validation Checks:
2025-05-08 11:04:54,654 72320 [DEBUG] - Reboot Requirement Checks:
2025-05-08 11:04:54,656 72320 [DEBUG] - - Pending Computer Rename = Checked
2025-05-08 11:04:54,656 72320 [DEBUG] - - Pending Component Based Servicing = Checked
2025-05-08 11:04:54,658 72320 [DEBUG] - - Pending Windows Auto Update = Checked
2025-05-08 11:04:54,658 72320 [DEBUG] - - Pending File Rename Operations = Ignored
2025-05-08 11:04:54,660 72320 [DEBUG] - - Pending Windows Package Installer = Checked
2025-05-08 11:04:54,660 72320 [DEBUG] - - Pending Windows Package Installer SysWow64 = Checked
2025-05-08 11:04:54,660 72320 [DEBUG] - Cache Folder Lockdown Checks:
2025-05-08 11:04:54,664 72320 [DEBUG] - - Elevated State = Checked
2025-05-08 11:04:54,664 72320 [DEBUG] - - Folder Exists = Checked
2025-05-08 11:04:54,664 72320 [DEBUG] - - Folder lockdown = Checked
2025-05-08 11:04:54,664 72320 [INFO ] - 3 validations performed. 3 success(es), 0 warning(s), and 0 error(s).
2025-05-08 11:04:54,674 72320 [DEBUG] - The source '' evaluated to a 'normal' source type
2025-05-08 11:04:54,674 72320 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2025-05-08 11:04:54,674 72320 [DEBUG] - Configuration: CommandName='install'|
CacheLocation='C:\Users\andrew.pilley\AppData\Local\Temp\chocolatey'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
SourceType='normal'|IncludeConfiguredSources='False'|
ShowOnlineHelp='False'|Debug='False'|Verbose='False'|Trace='False'|
Force='False'|Noop='False'|HelpRequested='False'|
UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='False'|DisableCompatibilityChecks='False'|
AcceptLicense='True'|AllowUnofficialBuild='False'|
AdditionalLogFileLocation='choco.log'|Input='.\packages.config'|
AllVersions='False'|SkipPackageInstallProvider='False'|
SkipHookScripts='False'|PackageNames='.\packages.config'|
Prerelease='True'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
CacheExpirationInMinutes='30'|AllowDowngrade='False'|
ForceDependencies='False'|PinPackage='False'|
Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.26100.0'|
Information.PlatformName='Windows 11'|
Information.ChocolateyVersion='2.4.3.0'|
Information.ChocolateyProductVersion='2.4.3'|
Information.FullName='choco, Version=2.4.3.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='andrew.pilley'|
Information.UserDomainName='LEICABIO'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='False'|Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|
Information.IsLicensedAssemblyLoaded='False'|
Information.LicenseType='Foss'|Information.CurrentDirectory='C:\dev'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
Features.UsePackageHashValidation='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
ListCommand.ExplicitPageSize='False'|
ListCommand.ExplicitSource='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
UpgradeCommand.IgnorePinned='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='Unknown'|
ApiKeyCommand.Command='Unknown'|PinCommand.Command='Unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
TemplateCommand.Command='unknown'|CacheCommand.Command='Unknown'|
CacheCommand.RemoveExpiredItemsOnly='False'|
2025-05-08 11:04:54,674 72320 [DEBUG] - _ Chocolatey:ChocolateyInstallCommand - Normal Run Mode _
2025-05-08 11:04:54,684 72320 [INFO ] - Installing from config file:
2025-05-08 11:04:54,685 72320 [INFO ] - .\packages.config
2025-05-08 11:04:54,685 72320 [ERROR] - Installation was NOT successful. There are no sources enabled for
packages, and none were passed as arguments.
2025-05-08 11:04:54,685 72320 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2025-05-08 11:04:54,690 72320 [DEBUG] - Exiting with 1
```

### Additional Context



Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with packages.config, disabled global sources, and `choco install packages.config -y --pre`, using the local package source shown in the issue. Trace the config-file installation path from that command; done means explicitly sourced local packages install successfully without passing an additional `--source` argument.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.