Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in PowerShell: String Length cannot be zero #1933

Open
thekpaul opened this issue Oct 7, 2019 · 4 comments
Open

Error in PowerShell: String Length cannot be zero #1933

thekpaul opened this issue Oct 7, 2019 · 4 comments
Assignees
Labels
0 - _Triaging ADD AUTO TESTS Things that typically go to Test-Kitchen - once completed, IN REGRESSION TEST SUITE label added

Comments

@thekpaul
Copy link

thekpaul commented Oct 7, 2019

What You Are Seeing?

I cannot use certain features such as install and upgrade due to a String Length problem. The error message states that the "string length cannot be zero parameter : variable" (The original error message is in Korean, this is a translated version).

What is Expected?

choco install { package name } is supposed to install a package.

How Did You Get This To Happen? (Steps to Reproduce)

Downloaded Chocolatey 0.10.15 via PowerShell Script in Admin Mode and immediately started choco install git.
Also tried every single installation from version 0.10.10, every single time this happens.

Issue reproduction

  1. Install Chocolatey (by whatever means you want)
  2. Open Registry Editor
  3. Navigate to HKCU\Environment (or HKLM\Environment)
  4. Edit (Default) key to include anything (or leave it blank)
  5. Attempt to run choco install <package> where <package> is the name of any package.
  6. Receive error that String Length cannot be zero

Output Log

Full Log Output

2019-10-07 17:07:32,136 32020 [INFO ] - Chocolatey v0.10.15
2019-10-07 17:07:32,150 32020 [DEBUG] - Chocolatey is running on Windows v 10.0.17763.0
2019-10-07 17:07:32,160 32020 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2019-10-07 17:07:32,162 32020 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2019-10-07 17:07:32,171 32020 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install -dv git
2019-10-07 17:07:32,179 32020 [DEBUG] - Received arguments: install -dv git
2019-10-07 17:07:32,285 32020 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2019-10-07 17:07:32,292 32020 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2019-10-07 17:07:32,303 32020 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2019-10-07 17:07:32,355 32020 [WARN ] - [Pending] Removing incomplete install for 'git.install'
2019-10-07 17:07:32,489 32020 [DEBUG] - Performing validation checks.
2019-10-07 17:07:32,497 32020 [DEBUG] - Global Configuration Validation Checks:
2019-10-07 17:07:32,504 32020 [DEBUG] -  - Package Exit Code / Exit On Reboot = Checked
2019-10-07 17:07:32,509 32020 [DEBUG] - System State Validation Checks:
2019-10-07 17:07:32,523 32020 [DEBUG] -  Reboot Requirement Checks:
2019-10-07 17:07:32,530 32020 [DEBUG] -  - Pending Computer Rename = Checked
2019-10-07 17:07:32,548 32020 [DEBUG] -  - Pending Component Based Servicing = Checked
2019-10-07 17:07:32,556 32020 [DEBUG] -  - Pending Windows Auto Update = Checked
2019-10-07 17:07:32,569 32020 [DEBUG] -  - Pending File Rename Operations = Ignored
2019-10-07 17:07:32,586 32020 [DEBUG] -  - Pending Windows Package Installer = Checked
2019-10-07 17:07:32,603 32020 [DEBUG] -  - Pending Windows Package Installer SysWow64 = Checked
2019-10-07 17:07:32,620 32020 [INFO ] - 2 validations performed. 2 success(es), 0 warning(s), and 0 error(s).
2019-10-07 17:07:32,633 32020 [DEBUG] - The source 'https://chocolatey.org/api/v2/' evaluated to a 'normal' source type
2019-10-07 17:07:32,647 32020 [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.
2019-10-07 17:07:32,687 32020 [DEBUG] - Configuration: CommandName='install'|
CacheLocation='C:\Users\thekp\AppData\Local\Temp\chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://chocolatey.org/api/v2/'|SourceType='normal'|
Debug='True'|Verbose='True'|Trace='False'|Force='False'|Noop='False'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='git'|AllVersions='False'|
SkipPackageInstallProvider='False'|PackageNames='git'|
Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.17763.0'|
Information.PlatformName='Windows 10'|
Information.ChocolateyVersion='0.10.15.0'|
Information.ChocolateyProductVersion='0.10.15'|
Information.FullName='choco, Version=0.10.15.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='thekp'|
Information.UserDomainName='DESKTOP-8H6K68F'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\WINDOWS\system32'|
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.ScriptsCheckLastExitCode='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'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='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.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|Proxy.BypassOnLocal='True'|
2019-10-07 17:07:32,780 32020 [DEBUG] - _ Chocolatey:ChocolateyInstallCommand - Normal Run Mode _
2019-10-07 17:07:32,790 32020 [INFO ] - Installing the following packages:
2019-10-07 17:07:32,829 32020 [INFO ] - git
2019-10-07 17:07:32,834 32020 [INFO ] - By installing you accept licenses for the packages.
2019-10-07 17:07:33,051 32020 [DEBUG] - Using 'https://chocolatey.org/api/v2/'.
2019-10-07 17:07:33,474 32020 [DEBUG] - - Supports prereleases? 'True'.
2019-10-07 17:07:33,484 32020 [DEBUG] - - Is ServiceBased? 'True'.
2019-10-07 17:07:33,885 32020 [DEBUG] - Package 'git' found on source 'https://chocolatey.org/api/v2/'
2019-10-07 17:07:33,980 32020 [INFO ] - [NuGet] Attempting to resolve dependency 'git.install (= 2.23.0)'.
2019-10-07 17:07:37,668 32020 [INFO ] - [NuGet] Attempting to resolve dependency 'chocolatey-core.extension (≥ 1.3.3)'.
2019-10-07 17:07:37,744 32020 [INFO ] - [NuGet] Attempting to resolve dependency 'chocolatey (≥ 0.10.7)'.
2019-10-07 17:07:39,790 32020 [INFO ] - [NuGet] Installing 'git.install 2.23.0'.
2019-10-07 17:07:39,830 32020 [DEBUG] - [NuGet] Added file 'LICENSE.txt' to folder 'git.install\legal'.
2019-10-07 17:07:39,842 32020 [DEBUG] - [NuGet] Added file 'VERIFICATION.txt' to folder 'git.install\legal'.
2019-10-07 17:07:39,854 32020 [DEBUG] - [NuGet] Added file 'chocolateyInstall.ps1' to folder 'git.install\tools'.
2019-10-07 17:07:40,260 32020 [DEBUG] - [NuGet] Added file 'Git-2.23.0-32-bit.exe' to folder 'git.install\tools'.
2019-10-07 17:07:40,669 32020 [DEBUG] - [NuGet] Added file 'Git-2.23.0-64-bit.exe' to folder 'git.install\tools'.
2019-10-07 17:07:40,682 32020 [DEBUG] - [NuGet] Added file 'helpers.ps1' to folder 'git.install\tools'.
2019-10-07 17:07:40,802 32020 [DEBUG] - [NuGet] Added file 'git.install.nupkg' to folder 'git.install'.
2019-10-07 17:07:41,158 32020 [DEBUG] - [NuGet] Added file 'git.install.nuspec' to folder 'git.install'.
2019-10-07 17:07:41,162 32020 [INFO ] - [NuGet] Successfully installed 'git.install 2.23.0'.
2019-10-07 17:07:41,166 32020 [INFO ] - 
git.install v2.23.0 [Approved]
2019-10-07 17:07:41,186 32020 [INFO ] - git.install package files install completed. Performing other installation steps.
2019-10-07 17:07:41,267 32020 [ERROR] - git not installed. An error occurred during installation:
 문자열의 길이는 0일 수 없습니다.
매개 변수 이름: variable
2019-10-07 17:07:41,272 32020 [INFO ] - git package files install completed. Performing other installation steps.
2019-10-07 17:07:41,274 32020 [DEBUG] - No package information as package is null.
2019-10-07 17:07:41,285 32020 [DEBUG] - No package information to save as package is null.
2019-10-07 17:07:41,297 32020 [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers...
2019-10-07 17:07:41,302 32020 [ERROR] - The install of git was NOT successful.
2019-10-07 17:07:41,306 32020 [ERROR] - git not installed. An error occurred during installation:
 문자열의 길이는 0일 수 없습니다.
매개 변수 이름: variable
2019-10-07 17:07:41,319 32020 [WARN ] - 
Chocolatey installed 1/2 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2019-10-07 17:07:41,338 32020 [INFO ] - 
2019-10-07 17:07:41,357 32020 [ERROR] - Failures
2019-10-07 17:07:41,361 32020 [ERROR] -  - git (exited 1) - git not installed. An error occurred during installation:
 문자열의 길이는 0일 수 없습니다.
매개 변수 이름: variable
2019-10-07 17:07:41,375 32020 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2019-10-07 17:07:41,468 32020 [DEBUG] - Exiting with 1

@thekpaul thekpaul changed the title String Length cannot be zero Error in PowerShell: String Length cannot be zero Oct 7, 2019
@thekpaul
Copy link
Author

thekpaul commented Oct 7, 2019

After factory-resetting my computer I found out that this problem happened because of a seemingly conflicting application called WinCUPL, which is also known to mess with other environmental variables such as the $PATH variable. Since this does not seem to be related to the Chocolatey project itself, I will close this issue.

@reinvantveer
Copy link

@thekpaul Thank you for filing this issue, I ran into the same trouble, also WinCUPL installed. Googling for this very quickly pointed me to this issue here! Uninstalling WinCUPL released PowerShell immediately from this confusing bug.

@zment4
Copy link

zment4 commented Apr 20, 2022

Just in case someone else has this same problem, and DON'T want to uninstall WinCUPL - apparently WinCUPL installer sets an empty string to the default item in the registry key for environment variables. To fix this without uninstalling WinCUPL, you can just open regedit, go to key HKEY_CURRENT_USER\Environment, right-click "(Default)" and click Delete. This makes the "value not set" and no more empty environment variable to throw choco off.

@corbob corbob reopened this Apr 27, 2022
@corbob
Copy link
Member

corbob commented Apr 27, 2022

Although the cause of this issue is not due to Chocolatey, we can better handle this error and gracefully continue where possible. I've reopened this issue, and will be updating the initial post with reproduction steps, and likely get a PR up to fix the issue in the coming weeks.

@corbob corbob added 0 - _Triaging ADD AUTO TESTS Things that typically go to Test-Kitchen - once completed, IN REGRESSION TEST SUITE label added and removed Invalid / Not Issue / No repro / Not Implementing labels Apr 27, 2022
@corbob corbob self-assigned this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - _Triaging ADD AUTO TESTS Things that typically go to Test-Kitchen - once completed, IN REGRESSION TEST SUITE label added
Projects
None yet
Development

No branches or pull requests

5 participants