[minor] pkl crashes when using a -o when you mean a -m for multiple output { files } #287

Closed
opened 2025-12-30 01:23:11 +01:00 by adam · 1 comment
Owner

Originally created by @mobileskyfi on GitHub (Feb 27, 2025).

Reporting as instructed... Happens with a simple .pkl file:

name = "test"
output {
    files {
        ["\(name).txt"] {
            text = "test"
        }
      } 
}

I came here to report & saw 0.28 release. Tried it, but same crash. Here is the stack trace from with --version of Pkl 0.28.0 (macOS 14.3.1, native):

pkl eval ./Specs/test.pkl -o './Machines'
An unexpected error has occurred. Would you mind filing a bug report?

java.nio.file.FileSystemException: /Users/amm0/PklPlist/Machines: Is a directory
        at java.base@21.0.5/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261)
        at java.base@21.0.5/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:482)
        at java.base@21.0.5/java.nio.file.Files.newOutputStream(Files.java:227)
        at java.base@21.0.5/java.nio.file.Files.write(Files.java:3492)
        at java.base@21.0.5/java.nio.file.Files.writeString(Files.java:3714)
        at org.pkl.commons.PathsKt.writeString(Paths.kt:51)
        at org.pkl.commons.PathsKt.writeString$default(Paths.kt:46)
        at org.pkl.cli.CliEvaluator.writeOutput(CliEvaluator.kt:158)
        at org.pkl.cli.CliEvaluator.doRun(CliEvaluator.kt:100)
        at org.pkl.commons.cli.CliCommand.run(CliCommand.kt:45)
        at org.pkl.cli.commands.EvalCommand.run(EvalCommand.kt:84)
        at com.github.ajalt.clikt.core.CoreCliktCommandKt.parse(CoreCliktCommand.kt:107)
        at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:78)
        at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:90)
        at org.pkl.cli.Main.main$lambda$0(Main.kt:26)
        at org.pkl.commons.cli.CliMainKt.cliMain(CliMain.kt:33)
        at org.pkl.cli.Main.main(Main.kt:26)

While I did read this in docs:

It is sometimes desirable for a single module to produce multiple output files. This is possible by configuring a module’s output.files property and specifying the --multiple-file-output-path (or -m for short) CLI option.

I forgot that part... I suppose it should CLI could suggest you need a -m instead, especially if given a a directory.

Originally created by @mobileskyfi on GitHub (Feb 27, 2025). Reporting as instructed... Happens with a simple .pkl file: ``` name = "test" output { files { ["\(name).txt"] { text = "test" } } } ``` I came here to report & saw 0.28 release. Tried it, but same crash. Here is the stack trace from with `--version` of `Pkl 0.28.0 (macOS 14.3.1, native)`: ``` pkl eval ./Specs/test.pkl -o './Machines' An unexpected error has occurred. Would you mind filing a bug report? java.nio.file.FileSystemException: /Users/amm0/PklPlist/Machines: Is a directory at java.base@21.0.5/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:261) at java.base@21.0.5/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:482) at java.base@21.0.5/java.nio.file.Files.newOutputStream(Files.java:227) at java.base@21.0.5/java.nio.file.Files.write(Files.java:3492) at java.base@21.0.5/java.nio.file.Files.writeString(Files.java:3714) at org.pkl.commons.PathsKt.writeString(Paths.kt:51) at org.pkl.commons.PathsKt.writeString$default(Paths.kt:46) at org.pkl.cli.CliEvaluator.writeOutput(CliEvaluator.kt:158) at org.pkl.cli.CliEvaluator.doRun(CliEvaluator.kt:100) at org.pkl.commons.cli.CliCommand.run(CliCommand.kt:45) at org.pkl.cli.commands.EvalCommand.run(EvalCommand.kt:84) at com.github.ajalt.clikt.core.CoreCliktCommandKt.parse(CoreCliktCommand.kt:107) at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:78) at com.github.ajalt.clikt.core.CoreCliktCommandKt.main(CoreCliktCommand.kt:90) at org.pkl.cli.Main.main$lambda$0(Main.kt:26) at org.pkl.commons.cli.CliMainKt.cliMain(CliMain.kt:33) at org.pkl.cli.Main.main(Main.kt:26) ``` While I did read this in docs: > It is sometimes desirable for a single module to produce multiple output files. This is possible by configuring a module’s [output.files](https://pkl-lang.org/package-docs/pkl/0.28.0/base/ModuleOutput#files) property **and specifying the [--multiple-file-output-path](https://pkl-lang.org/main/current/pkl-cli/index.html#multiple-file-output-path) (or -m for short) CLI option.** I forgot that part... I suppose it should CLI could suggest you need a `-m` instead, especially if given a a directory.
adam closed this issue 2025-12-30 01:23:11 +01:00
Author
Owner

@bioball commented on GitHub (Feb 27, 2025):

Makes sense, thanks for the bug report!

@bioball commented on GitHub (Feb 27, 2025): Makes sense, thanks for the bug report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#287