Bug: fatal error when chart location is invalid #146

Closed
opened 2025-12-30 01:21:30 +01:00 by adam · 7 comments
Owner

Originally created by @MarkSRobinson on GitHub (Apr 15, 2024).

Command:

pkl project package

Version:

Pkl 0.25.3 (Linux 5.15.0-1053-aws, native)

PklPackage:
PklProject.txt
(I had to rename it because of Github file filters)

Error:

An unexpected error has occurred. Would you mind filing a bug report?

org.pkl.core.packages.PackageLoadError: Received unexpected status code `500` when making request `GET https://example.com/chart@1.0.0`.
        at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.openExternalUri(PackageResolvers.java:208)
        at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.getDependencyMetadataAndComputeChecksum(PackageResolvers.java:103)
        at org.pkl.core.project.ProjectPackager.checkAlreadyPublishedPackage(ProjectPackager.java:175)
        at org.pkl.core.project.ProjectPackager.doPackage(ProjectPackager.java:162)
        at org.pkl.core.project.ProjectPackager.createPackages(ProjectPackager.java:122)
        at org.pkl.cli.CliProjectPackager.doRun(CliProjectPackager.kt:88)
        at org.pkl.commons.cli.CliCommand.run(CliCommand.kt:45)
        at org.pkl.cli.commands.ProjectCommand$Companion$PackageCommand.run(ProjectCommand.kt:145)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:198)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:211)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:211)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:18)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:400)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:397)
[PklProject.txt](https://github.com/apple/pkl/files/14983660/PklProject.txt)

        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:415)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:440)
        at org.pkl.cli.Main$main$1.invoke(Main.kt:52)
        at org.pkl.cli.Main$main$1.invoke(Main.kt:40)
        at org.pkl.commons.cli.CliMainKt.cliMain(CliMain.kt:31)
        at org.pkl.cli.Main.main(Main.kt:40)

Expected output:

Can't access https://example.com/chart@1.0.0 (HTTP GET 500)
Originally created by @MarkSRobinson on GitHub (Apr 15, 2024). Command: ``` pkl project package ``` Version: ``` Pkl 0.25.3 (Linux 5.15.0-1053-aws, native) ``` PklPackage: [PklProject.txt](https://github.com/apple/pkl/files/14983665/PklProject.txt) (I had to rename it because of Github file filters) Error: ``` An unexpected error has occurred. Would you mind filing a bug report? org.pkl.core.packages.PackageLoadError: Received unexpected status code `500` when making request `GET https://example.com/chart@1.0.0`. at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.openExternalUri(PackageResolvers.java:208) at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.getDependencyMetadataAndComputeChecksum(PackageResolvers.java:103) at org.pkl.core.project.ProjectPackager.checkAlreadyPublishedPackage(ProjectPackager.java:175) at org.pkl.core.project.ProjectPackager.doPackage(ProjectPackager.java:162) at org.pkl.core.project.ProjectPackager.createPackages(ProjectPackager.java:122) at org.pkl.cli.CliProjectPackager.doRun(CliProjectPackager.kt:88) at org.pkl.commons.cli.CliCommand.run(CliCommand.kt:45) at org.pkl.cli.commands.ProjectCommand$Companion$PackageCommand.run(ProjectCommand.kt:145) at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:198) at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:211) at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:211) at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:18) at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:400) at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:397) [PklProject.txt](https://github.com/apple/pkl/files/14983660/PklProject.txt) at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:415) at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:440) at org.pkl.cli.Main$main$1.invoke(Main.kt:52) at org.pkl.cli.Main$main$1.invoke(Main.kt:40) at org.pkl.commons.cli.CliMainKt.cliMain(CliMain.kt:31) at org.pkl.cli.Main.main(Main.kt:40) ``` Expected output: ``` Can't access https://example.com/chart@1.0.0 (HTTP GET 500) ```
adam added the bug label 2025-12-30 01:21:30 +01:00
adam closed this issue 2025-12-30 01:21:31 +01:00
Author
Owner

@odenix commented on GitHub (Apr 15, 2024):

I’ve seen similar errors before. I think the root cause is that CliProjectPackager.doRun doesn’t handle exceptions thrown by ProjectPackager.createPackages.

@odenix commented on GitHub (Apr 15, 2024): I’ve seen similar errors before. I think the root cause is that `CliProjectPackager.doRun` doesn’t handle exceptions thrown by `ProjectPackager.createPackages`.
Author
Owner

@eli-l commented on GitHub (Apr 16, 2024):

In case someone is looking for a solution to build a package w/o triggering exception:
pkl project package --skip-publish-check

@eli-l commented on GitHub (Apr 16, 2024): In case someone is looking for a solution to build a package w/o triggering exception: `pkl project package --skip-publish-check`
Author
Owner

@holzensp commented on GitHub (Apr 16, 2024):

It certainly is a bug that the exception isn't handled, but the exception itself is correct, so I advise against --skip-publish-check. Pkl checks whether you're not publishing a package with an existing version number. Conflicting versions will give you a very bad time.

@holzensp commented on GitHub (Apr 16, 2024): It certainly is a bug that the exception isn't handled, but the exception itself is correct, so I advise against `--skip-publish-check`. Pkl checks whether you're not publishing a package with an existing version number. Conflicting versions will give you a very bad time.
Author
Owner

@eli-l commented on GitHub (Apr 16, 2024):

It certainly is a bug that the exception isn't handled, but the exception itself is correct, so I advise against --skip-publish-check. Pkl checks whether you're not publishing a package with an existing version number. Conflicting versions will give you a very bad time.

Thank you for highlighting it, however I found out it is the only way for now to actually build the package w/o valid URL if I am going to use it locally. I expect it uses packageZipUrl which could not be a local file/dir. Definitely not a production-level solution, but we need a way to make it work to learn & experiment.

@eli-l commented on GitHub (Apr 16, 2024): > It certainly is a bug that the exception isn't handled, but the exception itself is correct, so I advise against `--skip-publish-check`. Pkl checks whether you're not publishing a package with an existing version number. Conflicting versions will give you a very bad time. Thank you for highlighting it, however I found out it is the only way for now to actually build the package w/o valid URL if I am going to use it locally. I expect it uses `packageZipUrl` which could not be a local file/dir. Definitely not a production-level solution, but we need a way to make it work to learn & experiment.
Author
Owner

@MarkSRobinson commented on GitHub (Apr 22, 2024):

@holzensp I've written up a small fix that improves the error message

@MarkSRobinson commented on GitHub (Apr 22, 2024): @holzensp I've written up a small fix that improves the error message
Author
Owner

@harryjackson commented on GitHub (Apr 24, 2024):

however I found out it is the only way for now to actually build the package w/o valid URL if I am going to use it locally.

I just ran into this issue

✗ pkl project package
An unexpected error has occurred. Would you mind filing a bug report?

org.pkl.core.packages.PackageLoadError: Received unexpected status code `500` when making request `GET https://example.com/pkl-project@0.0.1`.
	at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.openExternalUri(PackageResolvers.java:208)
	at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.getDependencyMetadataAndComputeChecksum(PackageResolvers.java:103)
	at org.pkl.core.project.ProjectPackager.checkAlreadyPublishedPackage(ProjectPackager.java:175)
	at org.pkl.core.project.ProjectPackager.doPackage(ProjectPackager.java:162)

Even though the stack trace looks like everything failed the package files were still created in the ".out/" directory ie

✗ tree .out
.out
└── pkl-project@0.0.1
    ├── pkl-project@0.0.1
    ├── pkl-project@0.0.1.sha256
    ├── pkl-project@0.0.1.zip
    └── pkl-project@0.0.1.zip.sha256

2 directories, 4 files
@harryjackson commented on GitHub (Apr 24, 2024): > however I found out it is the only way for now to actually build the package w/o valid URL if I am going to use it locally. I just ran into this issue ``` ✗ pkl project package An unexpected error has occurred. Would you mind filing a bug report? org.pkl.core.packages.PackageLoadError: Received unexpected status code `500` when making request `GET https://example.com/pkl-project@0.0.1`. at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.openExternalUri(PackageResolvers.java:208) at org.pkl.core.packages.PackageResolvers$AbstractPackageResolver.getDependencyMetadataAndComputeChecksum(PackageResolvers.java:103) at org.pkl.core.project.ProjectPackager.checkAlreadyPublishedPackage(ProjectPackager.java:175) at org.pkl.core.project.ProjectPackager.doPackage(ProjectPackager.java:162) ``` Even though the stack trace looks like everything failed the package files were still created in the ".out/" directory ie ```bash ✗ tree .out .out └── pkl-project@0.0.1 ├── pkl-project@0.0.1 ├── pkl-project@0.0.1.sha256 ├── pkl-project@0.0.1.zip └── pkl-project@0.0.1.zip.sha256 2 directories, 4 files ```
Author
Owner

@holzensp commented on GitHub (Apr 25, 2024):

I let that review sit for a day; few tweaks, but certainly useful, @MarkSRobinson!

@harryjackson, is the zip 0 bytes? Is pkl-project@0.0.1 the only dependency?

@holzensp commented on GitHub (Apr 25, 2024): I let that review sit for a day; few tweaks, but certainly useful, @MarkSRobinson! @harryjackson, is the zip 0 bytes? Is `pkl-project@0.0.1` the only dependency?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#146