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

Choco commands fail due to invalid Base-64 input data #3513

Open
6 tasks done
slarys728 opened this issue Sep 17, 2024 · 8 comments
Open
6 tasks done

Choco commands fail due to invalid Base-64 input data #3513

slarys728 opened this issue Sep 17, 2024 · 8 comments

Comments

@slarys728
Copy link

slarys728 commented Sep 17, 2024

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?

After every choco upgrade /install /uninstall command I get an error:
2024-09-17 13:34:06,040 13688 [ERROR] - The input data is not a valid Base-64 string because it contains a character with a base other than 64, more than two padding characters, or an invalid character among the padding characters. [choco_log.txt](https://github.com/user-attachments/files/17027571/choco_log.txt) 2024-09-17 13:34:06,045 13688 [ERROR] - More Details: System.FormatException: The input data is not a valid Base-64 string because it contains a character with a base other than 64, more than two padding characters, or an invalid character among the padding characters.. w System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) w System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) w System.Convert.FromBase64String(String s) w chocolatey.infrastructure.cryptography.DefaultEncryptionUtility.DecryptString(String encryptedString) w chocolatey.infrastructure.app.utility.ArgumentsUtility.<DecryptPackageArgumentsFile>d__1.MoveNext() w System.String.Join(String separator, IEnumerable1 values) w chocolatey.infrastructure.app.services.NugetService.<List>d__15.MoveNext() w System.Collections.Generic.List1..ctor(IEnumerable1 collection) w System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) w chocolatey.infrastructure.app.services.NugetService.GetInstalledPackages(ChocolateyConfiguration config) w chocolatey.infrastructure.app.services.NugetService.Install(ChocolateyConfiguration config, Action2 continueAction, Action2 beforeModifyAction) w chocolatey.infrastructure.app.services.ChocolateyPackageService.Install(ChocolateyConfiguration config) w chocolatey.infrastructure.app.runners.GenericRunner.Run(ChocolateyConfiguration config, Container container, Boolean isConsole, Action 1 parseArgs) w chocolatey.infrastructure.app.runners.ConsoleApplication.Run(String[] args, ChocolateyConfiguration config, Container container) w chocolatey.console.Program.Main(String[] args) 2024-09-17 13:34:06,045 13688 [DEBUG] - Exiting with 1

Full command log in the attachment.

What is Expected?

Command complete confirmation

How Did You Get This To Happen?

Error comes up when I run a commands:

  • choco install
  • choco upgrage
  • choco unistall

System Details

  • Operating System: Windows 11
  • Windows PowerShell version:
  • Chocolatey CLI Version: v2.3.0
  • Chocolatey Licensed Extension version:
  • Chocolatey License type: Free
  • Terminal/Emulator:

Installed Packages

Running choco list command also fail with the same error. It list packages
2024-09-17 13:34:05,937 13688 [DEBUG] - 7zip 24.8.0 2024-09-17 13:34:05,964 13688 [DEBUG] - 7zip.install 24.8.0 2024-09-17 13:34:05,969 13688 [DEBUG] - adobereader 2024.2.21005 2024-09-17 13:34:05,973 13688 [DEBUG] - advanced-ip-scanner 2.5.4594.1 2024-09-17 13:34:05,975 13688 [DEBUG] - atom.install 1.63.1 2024-09-17 13:34:05,979 13688 [DEBUG] - autohotkey.portable 2.0.18 2024-09-17 13:34:05,982 13688 [DEBUG] - autoruns 14.11.0 2024-09-17 13:34:05,985 13688 [DEBUG] - Unable to locate .arguments file for version '4.32.0' of package 'bginfo'. 2024-09-17 13:34:05,985 13688 [DEBUG] - bginfo 4.32.0 2024-09-17 13:34:05,990 13688 [DEBUG] - calibre 7.17.0 2024-09-17 13:34:05,995 13688 [DEBUG] - chocolatey 2.3.0 2024-09-17 13:34:05,998 13688 [DEBUG] - chocolatey-compatibility.extension 1.0.0 2024-09-17 13:34:06,002 13688 [DEBUG] - chocolatey-core.extension 1.4.0 2024-09-17 13:34:06,006 13688 [DEBUG] - chocolatey-dotnetfx.extension 1.0.1 2024-09-17 13:34:06,008 13688 [DEBUG] - chocolateygui 2.1.1 2024-09-17 13:34:06,012 13688 [DEBUG] - chocolatey-windowsupdate.extension 1.0.5 2024-09-17 13:34:06,016 13688 [DEBUG] - cpu-z.install 2.9.0.20240123 2024-09-17 13:34:06,019 13688 [DEBUG] - deepl 24.8.2.13437 2024-09-17 13:34:06,021 13688 [DEBUG] - dellcommandupdate 5.4.0 2024-09-17 13:34:06,025 13688 [DEBUG] - docker-cli 27.2.1

and then fails. I found in log file that next package should be:

2024-09-15 19:43:50,093 9932 [DEBUG] - DotNet4.5.2 4.5.2.20140902 2024-09-15 19:43:50,095 9932 [DEBUG] - Unable to locate .arguments file for version '4.6.1055.20170308' of package 'DotNet4.6.1'. 2024-09-15 19:43:50,096 9932 [DEBUG] - DotNet4.6.1 4.6.1055.20170308 2024-09-15 19:43:50,100 9932 [DEBUG] - dotnet4.7.2 4.7.2.20210903 2024-09-15 19:43:50,103 9932 [DEBUG] - dotnetfx 4.8.0.20220524 2024-09-15 19:43:50,107 9932 [DEBUG] - dropbox 207.4.5821 2024-09-15 19:43:50,111 9932 [DEBUG] - evernote 10.85.4 2024-09-15 19:43:50,113 9932 [DEBUG] - evernote-chrome 6.10.3 2024-09-15 19:43:50,116 9932 [DEBUG] - Everything 1.4.11024 2024-09-15 19:43:50,119 9932 [DEBUG] - gimp 2.10.36.1 2024-09-15 19:43:50,121 9932 [DEBUG] - git 2.44.0 2024-09-15 19:43:50,127 9932 [DEBUG] - git.install 2.44.0 2024-09-15 19:43:50,132 9932 [DEBUG] - GoogleChrome 120.0.6099.276 2024-09-15 19:43:50,135 9932 [DEBUG] - googledrive 89.0.2 2024-09-15 19:43:50,139 9932 [DEBUG] - grammarly-chrome 14.821.1.1383 2024-09-15 19:43:50,143 9932 [DEBUG] - greenshot 1.2.10.6 2024-09-15 19:43:50,146 9932 [DEBUG] - https-everywhere-chrome 2016.12.19 2024-09-15 19:43:50,150 9932 [DEBUG] - InkScape 1.3.2 2024-09-15 19:43:50,154 9932 [DEBUG] - intellijidea-community 2023.4.0 2024-09-15 19:43:50,157 9932 [DEBUG] - irfanview 4.67.0 2024-09-15 19:43:50,167 9932 [DEBUG] - irfanview-languages 4.67.0 2024-09-15 19:43:50,170 9932 [DEBUG] - irfanviewplugins 4.67.0 2024-09-15 19:43:50,174 9932 [DEBUG] - jre8 8.0.401 2024-09-15 19:43:50,177 9932 [DEBUG] - KB2919355 1.0.20160915 2024-09-15 19:43:50,180 9932 [DEBUG] - KB2919442 1.0.20160915 2024-09-15 19:43:50,183 9932 [DEBUG] - KB2999226 1.0.20181019 2024-09-15 19:43:50,186 9932 [DEBUG] - KB3033929 1.0.5 2024-09-15 19:43:50,189 9932 [DEBUG] - KB3035131 1.0.3 2024-09-15 19:43:50,194 9932 [DEBUG] - keepassxc 2.7.7 2024-09-15 19:43:50,197 9932 [DEBUG] - k-litecodecpackfull 18.3.0 2024-09-15 19:43:50,200 9932 [DEBUG] - koodo-reader 1.6.6 2024-09-15 19:43:50,204 9932 [DEBUG] - malwarebytes 5.1.2.88 2024-09-15 19:43:50,210 9932 [DEBUG] - maven 3.9.6 2024-09-15 19:43:50,213 9932 [DEBUG] - microsoft-teams 1.7.0.7956 2024-09-15 19:43:50,217 9932 [DEBUG] - mobaxterm 24.0.0 2024-09-15 19:43:50,220 9932 [DEBUG] - Unable to locate .arguments file for version '4.7.2' of package 'netfx-4.7.2'. 2024-09-15 19:43:50,221 9932 [DEBUG] - netfx-4.7.2 4.7.2 2024-09-15 19:43:50,225 9932 [DEBUG] - netfx-4.8 4.8.0.20220524 2024-09-15 19:43:50,228 9932 [DEBUG] - nodejs 21.7.1 2024-09-15 19:43:50,231 9932 [DEBUG] - nodejs.install 21.7.1 2024-09-15 19:43:50,234 9932 [DEBUG] - notepadplusplus 8.6.5 2024-09-15 19:43:50,237 9932 [DEBUG] - notepadplusplus.install 8.6.5 2024-09-15 19:43:50,240 9932 [DEBUG] - office365business 17328.20162.0 2024-09-15 19:43:50,243 9932 [DEBUG] - openjdk 21.0.2 2024-09-15 19:43:50,247 9932 [DEBUG] - openvpn 2.6.10.1 2024-09-15 19:43:50,251 9932 [DEBUG] - paint.net 5.0.13 2024-09-15 19:43:50,254 9932 [DEBUG] - PDFCreator 5.2.1 2024-09-15 19:43:50,260 9932 [DEBUG] - postman 10.24.16 2024-09-15 19:43:50,263 9932 [DEBUG] - procexp 17.5.0.20231021 2024-09-15 19:43:50,266 9932 [DEBUG] - putty 0.81.0 2024-09-15 19:43:50,269 9932 [DEBUG] - putty.portable 0.81.0 2024-09-15 19:43:50,273 9932 [DEBUG] - qfinderpro 7.9.1.817 2024-09-15 19:43:50,277 9932 [DEBUG] - qsync 5.1.4.129 2024-09-15 19:43:50,281 9932 [DEBUG] - simple-sticky-notes 6.3.0 2024-09-15 19:43:50,285 9932 [DEBUG] - skype 8.94.0.428 2024-09-15 19:43:50,288 9932 [DEBUG] - slack 4.37.101 2024-09-15 19:43:50,290 9932 [DEBUG] - spotify 1.2.35.663 2024-09-15 19:43:50,292 9932 [DEBUG] - tanzu-community-edition 0.12.1 2024-09-15 19:43:50,295 9932 [DEBUG] - teamviewer 15.52.4 2024-09-15 19:43:50,299 9932 [DEBUG] - totalcommander 11.3.0 2024-09-15 19:43:50,302 9932 [DEBUG] - treesizefree 4.7.2 2024-09-15 19:43:50,306 9932 [DEBUG] - vcredist140 14.38.33135 2024-09-15 19:43:50,312 9932 [DEBUG] - vcredist2010 10.0.40219.32503 2024-09-15 19:43:50,314 9932 [DEBUG] - vlc 3.0.20 2024-09-15 19:43:50,317 9932 [DEBUG] - vlc.install 3.0.20 2024-09-15 19:43:50,320 9932 [DEBUG] - vscode.install 1.88.1 2024-09-15 19:43:50,324 9932 [DEBUG] - WhatsApp 2.2306.9 2024-09-15 19:43:50,326 9932 [DEBUG] - Unable to locate .arguments file for version '1.62.0' of package 'windows-defender-browser-protection-chrome'. 2024-09-15 19:43:50,327 9932 [DEBUG] - windows-defender-browser-protection-chrome 1.62.0 2024-09-15 19:43:50,330 9932 [DEBUG] - winrar 7.0.0 2024-09-15 19:43:50,334 9932 [DEBUG] - winscp 6.3.2 2024-09-15 19:43:50,338 9932 [DEBUG] - winscp.install 6.3.2 2024-09-15 19:43:50,341 9932 [DEBUG] - wireshark 4.2.4 2024-09-15 19:43:50,346 9932 [DEBUG] - yarn 1.22.19 2024-09-15 19:43:50,350 9932 [DEBUG] - youtube-dl 2021.12.17 2024-09-15 19:43:50,354 9932 [DEBUG] - zoom 5.17.11.34827

Output Log

Additional Context

Problem appeared after upgrade chocolatey to v2.3.0

@slarys728 slarys728 added the Bug label Sep 17, 2024
@pauby
Copy link
Member

pauby commented Sep 17, 2024

Can you go back to the above and:

  1. Correct the title - provide an accurate title for your issue so that others may find it if they are searching for it. Referring to another issue doesn't provide any information.
  2. Fix the formatting in the 'What You Are Seeing' section of the description. It's difficult to read because the formatting is broken.
  3. Provide full steps of 'How Did You Get This To Happen'.
  4. Complete 'System Details' as the fields are not optional.
  5. For 'Installed Packages' please run choco list and paste that in.
  6. for 'Output Log' we need the full output log and not just the bit that you believe it relevant. That is stated in the template.

@slarys728 slarys728 changed the title Choco upgrade command fails due to Choco commands fail due to invalid Base-64 input data Sep 26, 2024
@slarys728
Copy link
Author

Full Output logs:
chocolatey.log

[Uploading choco.summary.1.log…]
chocolatey.1.log

choco.summary.log
()
chocolatey.2.log

@slarys728
Copy link
Author

@pauby is ok now?

@svonidze
Copy link

getting same error with CLI choco 2.3.0 and chocolateygui

---------------------------
Unhandled Exception
---------------------------
System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. 
   at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
   at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
   at System.Convert.FromBase64String(String s)
   at chocolatey.infrastructure.cryptography.DefaultEncryptionUtility.DecryptString(String encryptedString)
   at chocolatey.infrastructure.app.utility.ArgumentsUtility.<DecryptPackageArgumentsFile>d__1.MoveNext()
   at System.String.Join(String separator, IEnumerable`1 values)
   at chocolatey.infrastructure.app.services.NugetService.<List>d__15.MoveNext()
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.<List>d__23.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ChocolateyGui.Common.Windows.Services.ChocolateyService.<GetInstalledPackages>d__13.MoveNext() in C:\buildAgent\work\774e9aed9020e028\Source\ChocolateyGui.Common.Windows\Services\ChocolateyService.cs:line 85
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ChocolateyGui.Common.Windows.ViewModels.LocalSourceViewModel.<LoadPackages>d__80.MoveNext() in C:\buildAgent\work\774e9aed9020e028\Source\ChocolateyGui.Common.Windows\ViewModels\LocalSourceViewModel.cs:line 459
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at ChocolateyGui.Common.Windows.ViewModels.LocalSourceViewModel.<OnInitialize>d__78.MoveNext() in C:\buildAgent\work\774e9aed9020e028\Source\ChocolateyGui.Common.Windows\ViewModels\LocalSourceViewModel.cs:line 412
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at ChocolateyGui.App.Main(String[] args) in C:\buildAgent\work\774e9aed9020e028\Source\ChocolateyGui\App.xaml.cs:line 122

@svonidze
Copy link

The error is gone when I reinstalled choco by:

  • removing/renaming C:\ProgramData\chocolatey and
  • copying the lib folder to keep all installed packages

@aetonsi
Copy link

aetonsi commented Oct 23, 2024

had this problem too, out of nowhere.. had to fully reinstall chocolatey and restore every package, then reinstate them all (because just copying lib and bin from the previous install didn't make choco "see" the packages - i had to backup the list of installed packages via choco list and the choco install them one by one, with the -n parameter)

@gep13 gep13 added this to the 2.4.0 milestone Oct 24, 2024
@gep13
Copy link
Member

gep13 commented Oct 25, 2024

Reading through the logs attached to this issue, I am as sure as I can be that this is related to this issue #3503.

While the symptoms are slightly different, the underlying issue is still the same. There is something wrong with one of the .arguments files that Chocolatey CLI creates to persist the remembered arguments for a package installation.

The "fix" here would be to report the problem with the file, rather than abort the operation, as in some cases, information about the remembered arguments is not required.

@corbob is going to be spending some time looking into this issue, and will report back here once he has some more information.

@aetonsi said...
had to fully reinstall chocolatey and restore every package, then reinstate them all (because just copying lib and bin from the previous install didn't make choco "see" the packages - i had to backup the list of installed packages via choco list and the choco install them one by one, with the -n parameter)

This process should not have been required. Based on what I am seeing reported here, one of the .arguments files located in the .chocolatey folder was causing the problem. The process that you have followed bypasses these files by deleting them and then placing the files back into the lib and bin folders. We will do what we can to prevent the need for this process happening again.

@corbob
Copy link
Member

corbob commented Oct 25, 2024

@gep13 I think you're right about the relation to #3503. When I was looking through to track where I could fix that one, I stumbled upon this line:

var encryptedByteArray = Convert.FromBase64String(encryptedString);

It is one of the 4 places in the codebase where we're converting from base64, as well as it's consistent with the stack trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants