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

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

Open
ShammiL opened this issue Feb 2, 2024 · 2 comments · May be fixed by #42717
Open

Comments

@ShammiL
Copy link
Contributor

ShammiL commented Feb 2, 2024

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

@ballerina-bot ballerina-bot added the needTriage The issue has to be inspected and labeled manually label Feb 2, 2024
@Thevakumar-Luheerathan Thevakumar-Luheerathan self-assigned this May 6, 2024
@Thevakumar-Luheerathan Thevakumar-Luheerathan removed the needTriage The issue has to be inspected and labeled manually label May 6, 2024
@Thevakumar-Luheerathan
Copy link
Member

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
Copy link
Member

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 Thevakumar-Luheerathan linked a pull request May 9, 2024 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: PR Sent
Development

Successfully merging a pull request may close this issue.

4 participants