chocolatey / chocolatey/choco

Querying an explicit source when that source is disabled should error rather than returning 0 packages

Open
#3,030 2 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

### Checklist

- [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.

### What You Are Seeing?

Searching an explicit source, when the source is disabled, produce 0 packages found.

```
> choco source list
Chocolatey v1.2.1 Business

chocolatey - https://community.chocolatey.org/api/v2/ | Priority 0|Bypass Proxy - False|Self-Service - False|Admin Only - False.
chocolatey.licensed [Disabled] - https://licensedpackages.chocolatey.org/api/v2/ (Authenticated)| Priority 10|Bypass Proxy - False|Self-Service - False|Admin Only - False.

> choco search --source chocolatey.licensed
Chocolatey v1.2.1 Business

0 packages found.
```

### What is Expected?

If you specify an explicit source, and that source is 'unavailable' then Chocolatey CLI should tell you so rather than returning 0 packages.

### How Did You Get This To Happen?

Note that I'm using the `chocolatey.licensed` source here but this _should_ work with any source.

1. Get a list of the packages on a source using `choco search --source ='chocolatey.licensed'` (note that the quotes around the source name are required for PowerShell).
2. Disable the source using `choco source disable -n='chocolatey.licensed'`.
3. Get a list of the packages on the disabled source using `choco search --source ='chocolatey.licensed'`.

### System Details

* Operating System: 10.0.19045.0
* Windows PowerShell version: 7.3.2 (I also tried this on 5.1).
* Chocolatey CLI Version: 1.2.1
* Chocolatey Licensed Extension version: 5.0.1
* Chocolatey License type: Business
* Terminal/Emulator: Windows Terminal

### Installed Packages

```bash
N/A
```

### Output Log

```bash
This is about functionality of Chocolatey CLI so logs are not relevant.
```

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the Chocolatey CLI path handling `choco search --source` and the source enable/disable behavior described in the reproduction. Reproduce the commands against a disabled `chocolatey.licensed` source, then verify that an explicit unavailable source reports an error instead of returning 0 packages.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.