Skip to content

[2.x] fix: Fix whatDependsOn RuntimeException#8462

Merged
eed3si9n merged 38 commits intosbt:developfrom
Dairus01:fix-whatDependsOn-empty-version
Jan 13, 2026
Merged

[2.x] fix: Fix whatDependsOn RuntimeException#8462
eed3si9n merged 38 commits intosbt:developfrom
Dairus01:fix-whatDependsOn-empty-version

Conversation

@Dairus01
Copy link
Copy Markdown
Contributor

Fixes #8094 - RuntimeException: String literal cannot be empty in whatDependsOn command when the dependency graph contains modules with empty version strings.

Problem:
After the first successful run of whatDependsOn, subsequent runs fail because the persisted dependency graph contains modules with empty versions, causing parser token creation to fail.

Solution:

  • Filter out empty versions during parser construction to prevent token creation failure
  • Handle edge case where all versions are empty by providing fallback parser
  • Add test coverage for empty versions, mixed versions, and empty graphs

Testing:
All existing tests pass. Added 4 new test cases covering the regression and edge cases.

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=201190161

Filters out empty versions during parser construction to prevent RuntimeException when creating token parsers.  Includes comprehensive test coverage for edge cases.
@Dairus01
Copy link
Copy Markdown
Contributor Author

@eed3si9n please I would love you to review this PR.

I am open to changing anything in this pr

@eed3si9n eed3si9n changed the title Fix whatDependsOn RuntimeException with empty version strings [2.x] Fix whatDependsOn RuntimeException with empty version strings Jan 10, 2026
@eed3si9n
Copy link
Copy Markdown
Member

@Dairus01 Thanks for the contribution!
Could you also try reviving the integration test in https://github.com/sbt/sbt/tree/develop/sbt-app/src/sbt-test/dependency-graph/whatDependsOn plz, by renaming pending to test? It can be invoked from the sbt shell as:

scripted dependency-graph/whatDependsOn

From what I can tell the test seems to be calling whatDependsOn task. If the test doesn't run as-is, feel free to relax the expected checking etc.

Copy link
Copy Markdown
Contributor Author

@Dairus01 Dairus01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eed3si9n, thanks for your review. I have implemented the changes

Remove unnecessary plugins.sbt from scripted tests

DependencyTreePlugin loads automatically as an AutoPlugin. 
The addDependencyTreePlugin helper is unavailable in scripted
test contexts, causing CI failures.
DependencyTreePlugin is an AutoPlugin with trigger = AllRequirements,
so it loads automatically in scripted tests without requiring explicit
plugin configuration. 

The addDependencyTreePlugin helper is only available in the main sbt
build's project/ directory and is not accessible in isolated scripted
test environments, causing "Not found:  addDependencyTreePlugin" errors.

This aligns with other dependency-graph scripted tests which either
omit the plugins.sbt file entirely or comment out addDependencyTreePlugin.
@Dairus01
Copy link
Copy Markdown
Contributor Author

@eed3si9n I have fixed what was making that one check to fail

DependencyTreePlugin is an AutoPlugin with trigger = AllRequirements, so it loads automatically in scripted tests without requiring explicit plugin configuration.

@Dairus01
Copy link
Copy Markdown
Contributor Author

@eed3si9n please check now

Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Dairus01
Copy link
Copy Markdown
Contributor Author

@eed3si9n is there any other thing I should do or any suggestionsfor the checks to pass or is it ok like this?

Relax whatDependsOn test: assert presence of cats-effect artifact
@Dairus01
Copy link
Copy Markdown
Contributor Author

@eed3si9n is there any other issue

@eed3si9n
Copy link
Copy Markdown
Member

Once the CI passes, I think we're good to land.

@Dairus01
Copy link
Copy Markdown
Contributor Author

@eed3si9n please can you help me review the code

@eed3si9n
Copy link
Copy Markdown
Member

I was hoping scripted would be somewhat quick, but it looks like a wild sheep chase, so I'm ok with just landing as-is if the CI finishes ok.

@Dairus01
Copy link
Copy Markdown
Contributor Author

@eed3si9n all the CI tests have passed, what do you think?

@eed3si9n eed3si9n changed the title [2.x] Fix whatDependsOn RuntimeException with empty version strings [2.x] fix: Fix whatDependsOn RuntimeException Jan 13, 2026
@eed3si9n eed3si9n merged commit 4a36171 into sbt:develop Jan 13, 2026
14 checks passed
@nsutcliffe
Copy link
Copy Markdown

Thank you @Dairus01 !

@Dairus01
Copy link
Copy Markdown
Contributor Author

Thank you @Dairus01 !

It was a pleasure doing this, I would be doing more, if you have any other open issue you need to solve feel free to tag me to it

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

whatDependsOn fails after successful run (String literal cannot be empty)

3 participants