microsoft / microsoft/component-detection

pnpm detection exception

Open
#1,373 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
553
Forks
135
Avg merge
20h 58m
Merged PRs (30d)
6

Description

I'm seeing the following exception during component detection of a pnpm lock file:

```
##[error]Failed to read pnpm yaml file /__w/1/s/pnpm-lock.yaml
System.Collections.Generic.KeyNotFoundException: The given key '@x/y@link:../Y' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.ComponentDetection.Detectors.Pnpm.Pnpm9Detector.ProcessDependencyList(ISingleFileComponentRecorder singleFileComponentRecorder, Dictionary`2 components, Dictionary`2 dependencies, Boolean isDevelopmentDependency)
at Microsoft.ComponentDetection.Detectors.Pnpm.Pnpm9Detector.ProcessDependencySets(ISingleFileComponentRecorder singleFileComponentRecorder, Dictionary`2 components, PnpmHasDependenciesV9 item)
at Microsoft.ComponentDetection.Detectors.Pnpm.Pnpm9Detector.RecordDependencyGraphFromFile(String yamlFileContent, ISingleFileComponentRecorder singleFileComponentRecorder)
at Microsoft.ComponentDetection.Detectors.Pnpm.PnpmComponentDetectorFactory.OnFileFoundAsync(ProcessRequest processRequest, IDictionary`2 detectorArgs, CancellationToken cancellationToken)
````

I can provide the lock file privately (Teams/email).

Note that detection seems to continue afterwards and does show packages in the summary.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Microsoft.ComponentDetection.Detectors.Pnpm.Pnpm9Detector, especially ProcessDependencyList, and reproduce the exception with a pnpm-lock.yaml containing the reported linked dependency key. Confirm that component detection completes without the KeyNotFoundException and still reports the expected packages.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.