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.

[CLI] Png, WebP to Avif - BindingError: Cannot pass non-string to std::string

See original GitHub issue

Describe the bug Using squoosh-cli and trying to convert a png / webp to avif. I tried to alter the input options like passing the file name as a string, but to no avail. Converting from png to webp works without errors with the same input options pattern that is described below.

The command starts sucessfully (apparently successful decoding), but throws an error directly after starting the encoding process:

vvvv@maschine24 ~/Documents/KuttBjoern $ squoosh-cli --avif auto Kattbljor_Flip_v011_0000.webp 
0/1 ⠏ ▐▨▨▨▨▨╌╌╌╌╌▌ Encoding (4 threads)
 Kattbljor_Flip_v011_0000.webp: 241.68KBBindingError: Cannot pass non-string to std::string
    at BindingError.<anonymous> (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:268883)
    at new BindingError (eval at Tb (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:1:1), <anonymous>:2:34)
    at R (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:269189)
    at Object.toWireType (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:277225)
    at Object.decode (eval at Xa (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:1:1), <anonymous>:5:26)
    at decode (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:537777)
    at /home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:536028
    at async binarySearch (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:535409)
    at async autoOptimize (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:535909)
    at async encodeFile (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:537821)
Worker error:  Error [RuntimeError]: abort(BindingError: Cannot pass non-string to std::string). Build with -s ASSERTIONS=1 for more info.
    at process.w (/home/vvvv/.npm-packages/lib/node_modules/@squoosh/cli/build/index.js:7:376640)
    at process.emit (events.js:326:22)
    at processPromiseRejections (internal/process/promises.js:209:33)
0/1 ⠹ ▐▨▨▨▨▨╌╌╌╌╌▌ Encoding (4 threads)
 Kattbljor_Flip_v011_0000.webp: 241.68KB

After the error has occured, the command just continues to run the encoding step (presumably) indefinitely. I let it run for something like 10 minutes without success. A verbose option would be nice.

Version:

  • OS w/ version: 5.10.7-3-MANJARO, DE Cinnamon 4.8.6, bash
  • Node version: v12.20.1
  • npm version: 6.14.11

Additional context, screenshots, screencasts

npx @squoosh/cli --avif auto <file> acts identically.

On a side note: npx @squoosh/cli --avif <file> throws the error “error: missing required argument ‘files’” , which is either not accurate or an error on my side.

Thank you for the awesome work you do!

Edit1:

I also would like to mention, that on the webapp (vanilla Chrome Version 88.0.4324.150 (Official Build) (64-bit) / Firefox 85.0.1 (64-bit)) , the conversion to avif also runs indefinitely without finishing while other conversion run fine, but without throwing an error of course. Could this hint at a missing dependency on my side? Could additional debugging info be outputted to the browser console to make issues like this more transparent?

Edit2:

Are there other utils I should test the conversion with to exclude some possible error sources?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
spaytoncommented, Feb 23, 2021

I got the same error when using auto as stated in help text. On win10 it needed single quotes, ie change it to ‘auto’

Regarding your side note, it’s because the command is ambiguous, --avif has an optional config which follows after the --avif flag, it is using your <file> as that config. You can explicitly terminate the option input with a double hyphen, as follows

npx @squoosh/cli --avif -- <file>

0reactions
spaytoncommented, Feb 23, 2021

Ha, I know what you mean. I also run node under nvm (4 windows), that dynamic duo can be doubly joyful.

Some more info, The previous ver 0.6.1 works fine when run like this

image

but then trying this:

npx @squoosh/cli@0.6.1 -V

fails just like above

so it seems more likely its a problem when specifying the version with npx, than a new problem with the current build.

I installed it globally with npm and its fine -

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot pass non-string to std::string error · Issue #11 - GitHub
I'm trying to use this lib but keep getting this error: BindingError { name: 'BindingError', message: 'Cannot pass non-string to ...
Read more >
Using Modern Image Formats: AVIF And WebP
In this article, we'll highlight how modern image formats (AVIF or WebP) ... JPEG and PNG are both used extensively depending on the...
Read more >
sitemap-questions-194.xml - Stack Overflow
... https://stackoverflow.com/questions/716153/java-command-line-arguments ... /3005662/how-to-force-a-sql-server-2008-database-to-go-offline 2018-03-30 ...
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