chocolatey / chocolatey/choco

Install-ChocolateyInstallPackage docs/function mismatch

Open
#1,163 4 comments 0 reactions 0 assignees View on GitHub
0 - Triaging Bug
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### What You Are Seeing?
Calling Install-ChocolateyInstallPackage for a local .msi without specifying the `-filetype` parameter causes a `ERROR: Exception calling "Start" with "0" argument(s): "The specified executable is not a valid application for this OS platform."`

### What is Expected?
FileType is not required and will be determined if not given. The documenation for Install-ChocolateyInstallPackage includes in the FileType parameter description:
> If this is not provided, Chocolatey will automatically determine this using the downloaded file's extension.

### Observation:
The FileType parameter definition in the function sets the default value to 'exe':
```powershell
[parameter(Mandatory=$false, Position=1)]
[alias("installerType","installType")][string] $fileType = 'exe',
```
Later, there is code to determine the filetype if it wasn't given:
```powershell
if ($fileType -eq '' -or $fileType -eq $null) {
```
but this will never be true due to the default 'exe' assignment.

Contributor guide

Open the contributing guide

Research direction

Start with the Install-ChocolateyInstallPackage function and compare the FileType parameter default with the later empty-or-null check. Verify the behavior for a local .msi without -filetype, then run the relevant existing tests if available. Done means the documented automatic file-type detection works instead of treating the MSI as an executable.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.