question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package command fails with zip error

See original GitHub issue

Version(s)

> scala-cli about
Scala CLI version 0.1.2

jvm and others, as installed by the tool at the first step:

❯ echo 'println("Hello")' | scala-cli -
Downloading JVM index
Downloading JVM temurin:17
Bloop daemon status: not running
Starting Bloop 1.4.19 at /home/vascod/.local/share/scalacli/bloop/daemon using JVM /home/vascod/.cache/coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17%252B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz/jdk-17+35/bin/java
Downloading compilation server 1.4.19
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Getting list of Scala CLI-supported Scala versions
Downloading Scala 3.1.1 compiler
Downloading one dependency and one internal dependency
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
Hello

os: Archlinux, x86_64

Describe the bug

Installed scala-cli and was following the Getting started guide: https://scala-cli.virtuslab.org/docs/getting_started

When reaching the step packaging (https://scala-cli.virtuslab.org/docs/getting_started#packaging) the output of the tool is the following:

❯ scala-cli package . -o countByExtension
Error: java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
For more details, please see '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log'

To Reproduce

Basically I was just following along the tutorial. Installed the tool, did the script, made a new file, things are compiling and running, but at the package step it fails.

All steps ran in the folder I did for testing:

░▒▓  ~/dev/r/test-proj ▓▒░─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ echo 'println("Hello")' | scala-cli -
Downloading JVM index
Downloading JVM temurin:17
Bloop daemon status: not running
Starting Bloop 1.4.19 at /home/vascod/.local/share/scalacli/bloop/daemon using JVM /home/vascod/.cache/coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17%252B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz/jdk-17+35/bin/java
Downloading compilation server 1.4.19
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala-library/maven-metadata.xml
Downloading https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Downloaded https://repo1.maven.org/maven2/org/scala-lang/scala3-library_3/maven-metadata.xml
Getting list of Scala CLI-supported Scala versions
Downloading Scala 3.1.1 compiler
Downloading one dependency and one internal dependency
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
Hello
❯ scala-cli hello.sc 
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
Hello!
❯ scala-cli hello.sc -- yes
Hello: yes!
❯ scala-cli repl --dep com.lihaoyi::os-lib:0.7.8
Downloading 2 dependencies
Welcome to Scala 3.1.1 (17.0.3, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                                                            
scala> os.pwd
val res0: os.Path = /home/vascod/dev/r/test-proj
                                                                                                                                                                            
scala> os.walk(os.pwd)
val res1: IndexedSeq[os.Path] = ArraySeq(/home/vascod/dev/r/test-proj/.scala-build, /home/vascod/dev/r/test-proj/.scala-build/ide-options.json, /home/vascod/dev/r/test-proj/.scala-build/.bloop, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627.json, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/project_940fb43dce_940fb43dce-78cc9a9627-analysis.bin, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/bloop-internal-classes, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/bloop-internal-classes/main-M28pOQYsSIiO18sXX6DXSg==, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a9627/bloop-internal-classes/main-M28pOQYsSIiO18sXX6DXSg==/hello_sc$.class, /home/vascod/dev/r/test-proj/.scala-build/.bloop/project_940fb43dce_940fb43dce-78cc9a96 ... large output truncated, print value to show all
                                                                                                                                                                            
scala> 
░▒▓  ~/dev/r/test-proj ▓▒░─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ mkdir scala-cli-getting-started
░▒▓  ~/dev/r/test-proj/scala-cli-getting-started ▓▒░───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ nvim files.scala
❯ scala-cli compile .
Compiling project (Scala 3.1.1, JVM)
Compiled project (Scala 3.1.1, JVM)
❯ lx
drwxr-xr-x   - vascod 31 Mar 11:09  .bsp
drwxr-xr-x   - vascod 31 Mar 11:09  .scala-build
.rw-r--r-- 220 vascod 31 Mar 11:09  files.scala
❯ nvim countByExtension.sc
❯ scala-cli . -- scala
files.scala
.scala-build/project_97d768c1d3_97d768c1d3/src_generated/main/countByExtension.scala
❯ scala-cli package . -o countByExtension
Error: java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
For more details, please see '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log'
❯ bat '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log'
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721542-14117431504118333474.log
       │ Size: 1.8 KB
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
   2   │   java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:409)
   3   │   java.util.zip.ZipInputStream.read(ZipInputStream.java:198)
   4   │   coursier.launcher.internal.FileUtil$.readFullyUnsafe(FileUtil.scala:20)
   5   │   coursier.launcher.internal.Zip$$anon$1.next(Zip.scala:20)
   6   │   coursier.launcher.internal.Zip$$anon$1.next(Zip.scala:10)
   7   │   scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:514)
   8   │   scala.collection.Iterator.foreach(Iterator.scala:943)
   9   │   scala.collection.Iterator.foreach$(Iterator.scala:943)
  10   │   scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
  11   │   coursier.launcher.BootstrapGenerator$.writeZip(BootstrapGenerator.scala:112)
  12   │   coursier.launcher.BootstrapGenerator$.$anonfun$generate$2(BootstrapGenerator.scala:62)
  13   │   coursier.launcher.BootstrapGenerator$.$anonfun$generate$2$adapted(BootstrapGenerator.scala:18)
  14   │   coursier.launcher.internal.FileUtil$.withOutputStream(FileUtil.scala:43)
  15   │   coursier.launcher.BootstrapGenerator$.generate(BootstrapGenerator.scala:18)
  16   │   scala.cli.commands.Package$.scala$cli$commands$Package$$bootstrap(Package.scala:484)
  17   │   scala.cli.commands.Package$stateMachine$async$1.apply(Package.scala:174)
  18   │   scala.build.EitherStateMachine.start(EitherCps.scala:58)
  19   │   scala.cli.commands.Package$.doPackage(Package.scala:98)
  20   │   scala.cli.commands.Package$.run(Package.scala:83)
  21   │   scala.cli.commands.Package$.run(Package.scala:32)
  22   │   caseapp.core.app.CaseApp.main(CaseApp.scala:149)
  23   │   caseapp.core.app.CommandsEntryPoint.main(CommandsEntryPoint.scala:116)
  24   │   scala.cli.ScalaCliCommands.main(ScalaCliCommands.scala:89)
  25   │   scala.cli.ScalaCli$.main0(ScalaCli.scala:148)
  26   │   scala.cli.ScalaCli$.main(ScalaCli.scala:71)
  27   │   scala.cli.ScalaCli.main(ScalaCli.scala)
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ scala-cli package . -o xx
Error: java.util.zip.ZipException: invalid entry CRC (expected 0xb6119209 but got 0x3392577b)
For more details, please see '/home/vascod/dev/r/test-proj/scala-cli-getting-started/.scala-build/stacktraces/1648721679-10697199402516022739.log'
❯ lx
drwxr-xr-x   - vascod 31 Mar 11:09  .bsp
drwxr-xr-x   - vascod 31 Mar 11:12  .scala-build
.rw-r--r-- 72k vascod 31 Mar 11:12  countByExtension
.rw-r--r-- 345 vascod 31 Mar 11:11  countByExtension.sc
.rw-r--r-- 220 vascod 31 Mar 11:09  files.scala
.rw-r--r-- 72k vascod 31 Mar 11:14  xx

Doing a clean an retrying again same error.

Expected behaviour I should be getting the output script to be run as the docs say (./countByExtension), instead of an error when packaging.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alexarchambaultcommented, May 6, 2022

As was commented on https://github.com/oracle/graal/issues/4479, this seems to originate from (apparently legit?) changes in zlib. It seems a workaround should be available in Arch Linux at some point.

1reaction
alexarchambaultcommented, Apr 8, 2022

That seems to be a native image issue… I opened https://github.com/oracle/graal/issues/4479 for it. https://github.com/VirtusLab/scala-cli/pull/865 should help in the mean time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

R build package fails on zip
The best answer I found was adding '--preclean' to the build arguments. >devtools::build(binary = TRUE,path=".", args = c('--preclean')).
Read more >
Error on serverless deploy: zip error: Invalid command ...
I have a serverless project, which I can deploy on one machine. When I try to deploy it on another machine, I get...
Read more >
Error 2 running command xx - the cause and fix
An Error 2 running command xx message usually indicates that path information in the original Zip file was not entered in the command...
Read more >
Zip compression fails if there is a file with a specific file name
Ubuntu version: 10.04 32 bits package: zip (3.0-3). Problem: Zip compression fails with the mesasge "zip error: Invalid command arguments ...
Read more >
zip command failing in post session command task - Search
When a zip command is used in the post session command task to zip a file of more than 4GB size, it fails...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found