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.

UnhandledRejection due to Unexpected end of input

See original GitHub issue

Describe the bug

When running reg-cli with a bunch of rendered images I get an UnhandledRejection error and the application freezes. I realized that empty pngs trigger this, which I was able to solve by first deleting those files. But it also seems that corrupt files also trigger the error. I’m not sure which file is triggering the error.

Reproduced step

Steps to reproduce the behavior:

  1. Add an empty png file to the source folder.

Expected behavior

Invalid image files should not crash or hand the process.

Actual behavior

(node:49896) UnhandledPromiseRejectionWarning: Error: Unexpected end of input
    at module.exports.ChunkStream._end (/usr/local/lib/node_modules/reg-cli/node_modules/pngjs/lib/chunkstream.js:92:24)
    at module.exports.ChunkStream.end (/usr/local/lib/node_modules/reg-cli/node_modules/pngjs/lib/chunkstream.js:81:10)
    at exports.PNG.PNG.end (/usr/local/lib/node_modules/reg-cli/node_modules/pngjs/lib/png.js:100:16)
    at ReadStream.onend (_stream_readable.js:677:10)
    at Object.onceWrapper (events.js:421:28)
    at ReadStream.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1224:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:49896) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:49896) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sk-commented, Feb 22, 2021

@bokuweb Unfortunately I don’t have the files anymore. But It seemed like a truncated png file as when I opened it, it showed only half of it.

Note that an empty file with a .png extension will trigger the same issue.

0reactions
bokuwebcommented, Feb 22, 2021

@sk- I see, I’ll try it later. thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled Rejection (SyntaxError): Unexpected end of input
The error you are getting is because, it sends the empty response( eg. Getting the response as empty object {}), in that you...
Read more >
Unexpected end of input Error in JavaScript - Stack Diary
Here are some common reasons why the "Unexpected end of input" error may occur: Syntax error in the code, such as a missing...
Read more >
SyntaxError: Unexpected end of input in JavaScript [Solved]
The "Uncaught SyntaxError: Unexpected end of input" error occurs for 3 main reasons: Forgetting a closing parenthesis, bracket or quote. Trying to parse...
Read more >
Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >
unexpected end of JSON input js' (JavaScript, JSON, Node.js ...
How do you resolve "Uncaught (in promise) syntax error: unexpected end of JSON input js" (JavaScript, JSON, Node.js, development)?. All related (33).
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