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

Bundler fails to parse dependency "NoSuchElementException: Key spoon is missing in the map." #7478

Closed
bennati opened this issue Sep 7, 2023 · 14 comments
Labels
analyzer About the analyzer tool needs info An issue where further information is required

Comments

@bennati
Copy link
Contributor

bennati commented Sep 7, 2023

One of our projects gets the following scan issue:
Failed to parse dependency 'spoon' of project 'Bundler::Gemfile:' in '/builds/oss/oss-review-toolkit/ort-gitlab-ci/project': NoSuchElementException: Key spoon is missing in the map.

I was able to reproduce the issue with this minimal Gemfile:

# frozen_string_literal: true

source 'https://rubygems.org'

ruby '3.0.2'

source '<ARTIFACTORY>' do
  gem 'bootstrap-sass-2', '2.3.2.2.pre.5'
end

group :test, :development, :ui_test do
  gem 'pry-rails'
end

Interestingly, the error disappears when changing the Gemfile to the following:

# frozen_string_literal: true

source 'https://rubygems.org'

ruby '3.0.2'

gem 'bootstrap-sass', '2.3.2.2'

group :test, :development, :ui_test do
  gem 'pry-rails'
end

Here is the diff between bootstrap-sass-2:2.3.2.2.pre.5 and bootstrap-sass:2.3.2.2

@sschuberth sschuberth added analyzer About the analyzer tool needs info An issue where further information is required labels Sep 7, 2023
@sschuberth
Copy link
Member

Can you please share a stacktrace, or a real value for the <ARTIFACTORY> placeholder?

@bennati
Copy link
Contributor Author

bennati commented Sep 8, 2023

There is no stacktrace: the error is not fatal and the analyzer continues

 ______________________________                                                
/        \_______   \__    ___/ The OSS Review Toolkit, version fdd83a3.       
|    |   | |       _/ |    |                                                   
|    |   | |    |   \ |    |    Running 'analyze' as 'ort' under Java 17.0.8 on
\________/ |____|___/ |____|    with 4 CPUs and a maximum of 27648 MiB of memor
                                                                               
Environment variables:                                                        
ORT_CONFIG_DIR = ort-configuration                                            
ORT_DATA_DIR = /builds/oss/oss-review-toolkit/ort-gitlab-ci/.ort              
JAVA_HOME = /opt/java/openjdk                                                 
ANDROID_HOME = /opt/android-sdk                                               
                                                                              
Looking for ORT configuration in the following file:
        /builds/oss/oss-review-toolkit/ort-gitlab-ci/config.yml

Looking for analyzer-specific configuration in the following files and directories:
	/builds/oss/oss-review-toolkit/ort-gitlab-ci/project/.ort.yml (does not exist)
	/builds/oss/oss-review-toolkit/ort-gitlab-ci/ort-configuration/resolutions.yml
The following 25 package manager(s) are enabled:
	Bower, Bundler, Cargo, Carthage, CocoaPods, Composer, Conan, GoDep, GoMod, Gradle, Maven, NPM, NuGet, PIP, Pipenv, PNPM, Poetry, Pub, SBT, SpdxDocumentFile, SPM, Stack, Unmanaged, Yarn, Yarn2
The following 2 package curation provider(s) are enabled:
	RepositoryConfiguration, File
Analyzing project path:
	/builds/oss/oss-review-toolkit/ort-gitlab-ci/project
Found 1 Bundler definition file(s) at:
	Gemfile
Found 1 NPM definition file(s) at:
	package.json
Found in total 2 definition file(s) from the following 2 package manager(s):
	Bundler, NPM
WARNING:  You don't have /home/ort/.local/share/gem/jruby/3.1.0/bin in your PATH,
	  gem executables will not run.
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
09:54:40.509 [DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Failed to parse dependency 'spoon' of project 'Bundler::Gemfile:' in '/builds/oss/oss-review-toolkit/ort-gitlab-ci/project': NoSuchElementException: Key spoon is missing in the map.
09:54:45.304 [DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Failed to parse dependency 'spoon' of project 'Bundler::Gemfile:' in '/builds/oss/oss-review-toolkit/ort-gitlab-ci/project': NoSuchElementException: Key spoon is missing in the map.
09:54:45.305 [DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Failed to parse dependency 'spoon' of project 'Bundler::Gemfile:' in '/builds/oss/oss-review-toolkit/ort-gitlab-ci/project': NoSuchElementException: Key spoon is missing in the map.
09:54:52.030 [DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Failed to parse dependency 'spoon' of project 'Bundler::Gemfile:' in '/builds/oss/oss-review-toolkit/ort-gitlab-ci/project': NoSuchElementException: Key spoon is missing in the map.
09:54:52.036 [DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Failed to parse dependency 'spoon' of project 'Bundler::Gemfile:' in '/builds/oss/oss-review-toolkit/ort-gitlab-ci/project': NoSuchElementException: Key spoon is missing in the map.
Writing analyzer result to '/builds/oss/oss-review-toolkit/ort-gitlab-ci/ort-results/analyzer-result.json'.
The analysis took 5m 18.309024162s.

I shared the value of with you on Slack

@sschuberth
Copy link
Member

There is no stacktrace: the error is not fatal and the analyzer continues

Have you tried --stacktrace which also lists suppressed exceptions?

@bennati
Copy link
Contributor Author

bennati commented Sep 11, 2023

Here is the stacktrace:

13:27:19.337 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Parsing dependency 'pry-rails'.
13:27:19.444 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.utils.ort.OkHttpClientHelper - Downloaded from https://rubygems.org/api/v2/rubygems/pry-rails/versions/0.3.9.yaml via network.
13:27:19.444 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Parsing dependency 'pry'.
13:27:19.445 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.utils.ort.OkHttpClientHelper - Retrieved https://rubygems.org/api/v2/rubygems/pry/versions/0.13.1.yaml from local cache.
13:27:19.445 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Parsing dependency 'coderay'.
13:27:19.445 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.utils.ort.OkHttpClientHelper - Retrieved https://rubygems.org/api/v2/rubygems/coderay/versions/1.1.3.yaml from local cache.
13:27:19.445 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Parsing dependency 'method_source'.
13:27:19.445 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.utils.ort.OkHttpClientHelper - Retrieved https://rubygems.org/api/v2/rubygems/method_source/versions/1.0.0.yaml from local cache.
13:27:19.445 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Parsing dependency 'spoon'.
java.util.NoSuchElementException: Key spoon is missing in the map.
	at kotlin.collections.MapsKt__MapWithDefaultKt.getOrImplicitDefaultNullable(MapWithDefault.kt:24)
	at kotlin.collections.MapsKt__MapsKt.getValue(Maps.kt:360)
	at org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler.parseDependency(Bundler.kt:274)
	at org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler.parseDependency(Bundler.kt:292)
	at org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler.parseDependency(Bundler.kt:292)
	at org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler.parseScope(Bundler.kt:257)
	at org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler.resolveDependencies(Bundler.kt:215)
	at org.ossreviewtoolkit.analyzer.PackageManager.resolveDependencies(PackageManager.kt:319)
	at org.ossreviewtoolkit.analyzer.PackageManagerRunner$run$3.invokeSuspend(Analyzer.kt:323)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
13:27:19.448 [DefaultDispatcher-worker-1] ERROR org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Failed to parse dependency 'spoon' of project 'Bundler::Gemfile:' in '/builds/oss/oss-review-toolkit/ort-gitlab-ci/project': NoSuchElementException: Key spoon is missing in the map.
13:27:19.448 [DefaultDispatcher-worker-1] DEBUG org.ossreviewtoolkit.plugins.packagemanagers.bundler.Bundler - Parsing dependency 'rspec-rails'.

@sschuberth
Copy link
Member

Could be a very similar problem to #7523 or #7543.

@bennati

This comment was marked as off-topic.

@sschuberth

This comment was marked as off-topic.

@aames-cls
Copy link

I'm having a similar issue as well

WARNING:  You don't have /home/ort/.local/share/gem/jruby/3.1.0/bin in your PATH,
	  gem executables will not run.
java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.textValue()" because the return value of "com.fasterxml.jackson.databind.JsonNode.get(String)" is null
	at org.ossreviewtoolkit.plugins.packagemanagers.bundler.GemSpec$Companion.createFromMetadata(Bundler.kt:423)

@sschuberth
Copy link
Member

@aames-cls, can you please share the project you're using for testing?

@lancedikson
Copy link

lancedikson commented May 13, 2024

I see a similar issue as @aames-cls mentioned only when my Gemfile includes comments # some comment. Removing the comments helps to bypass the problem.

@sschuberth
Copy link
Member

@lancedikson are you able to reproduce the problem by adding comments to any of the test projects in this directory? Because I tried, and I can't.

@sschuberth
Copy link
Member

@lancedikson, your issue (with is different from the original issue reported in this thread) should be fixed by #8644. Please give it a try.

@sschuberth
Copy link
Member

@aames-cls I believe your issue (which also is different than the OP's) got also resolved with #8644.

@sschuberth
Copy link
Member

Closing due to a lack of feedback.

@sschuberth sschuberth closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer About the analyzer tool needs info An issue where further information is required
Projects
None yet
Development

No branches or pull requests

4 participants