ballerina-lang icon indicating copy to clipboard operation
ballerina-lang copied to clipboard

[Bug]: Building a project with a corrupted Dependencies.toml causes a bad sad error for some cases

Open ShammiL opened this issue 1 year ago • 2 comments

Description

When there's corrupted Dependencies.toml file in a Ballerina package(this could be a missing field or an invalid value in a field), and the project is built, the build will fail with the following bad sad error.

ballerina: Oh no, something really went wrong. Bad. Sad.

We appreciate it if you can report the code that broke Ballerina in
https://github.com/ballerina-platform/ballerina-lang/issues with the
log you get below and your sample code.

We thank you for helping make us better.

[2024-02-02 14:49:07,734] SEVERE {b7a.log.crash} - Cannot find the generated jar library for module: module_sample 
java.lang.IllegalStateException: Cannot find the generated jar library for module: module_sample
        at io.ballerina.projects.JBallerinaBackend.lambda$codeGeneratedLibrary$5(JBallerinaBackend.java:531)
        at java.base/java.util.Optional.orElseThrow(Optional.java:403)
        at io.ballerina.projects.JBallerinaBackend.codeGeneratedLibrary(JBallerinaBackend.java:530)
        at io.ballerina.projects.JBallerinaBackend.codeGeneratedLibrary(JBallerinaBackend.java:298)
        at io.ballerina.projects.JBallerinaBackend.createManifest(JBallerinaBackend.java:429)
        at io.ballerina.projects.JBallerinaBackend.emitExecutable(JBallerinaBackend.java:536)
        at io.ballerina.projects.JBallerinaBackend.emit(JBallerinaBackend.java:219)
        at io.ballerina.cli.task.CreateExecutableTask.execute(CreateExecutableTask.java:114)
        at io.ballerina.cli.TaskExecutor.executeTasks(TaskExecutor.java:40)
        at io.ballerina.cli.cmd.BuildCommand.execute(BuildCommand.java:288)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at io.ballerina.cli.launcher.Main.main(Main.java:58)

At the end, the Dependencies.toml is generated again correcting the fields that were missing/invalid.

Steps to Reproduce

No response

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Other Area

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

ShammiL avatar Feb 02 '24 09:02 ShammiL

Can you share the project directory? I tried a few examples(changed some unavailable versions, and removed a few dependencies etc), but I couldn't reproduce it.

Thevakumar-Luheerathan avatar May 06 '24 08:05 Thevakumar-Luheerathan

This bad sad error occurs when we don't generate the thin jar for the package inside ./target/cache/<org>/<packagename>/<version>/<platform> directory because of corrupted Dependencies.toml. To resolve this issue, we decided to eliminate the corrupted Dependencies.toml and continue the build without Dependencies.toml.

Thevakumar-Luheerathan avatar May 08 '24 09:05 Thevakumar-Luheerathan

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

github-actions[bot] avatar Jun 11 '24 06:06 github-actions[bot]