Error "Unexpected end of multipart data" in busboy file upload

concept of error
error thesaurus
error definition in computer
error definition chemistry
how to pronounce error
what is error and types of error
error formula
error mac

I am using connect-busboy to upload file in node/express app.The problem is sometimes it works(file get uploaded succsesfully) and sometimes i get error Unexpected end of multipart data and the application crash.What could be the cause of this error? Also any help on how to debug this will be appreciated. I am using node version 5 and connect-busboy": "0.2.14"Thank you in advance

  .post (function(req, res) {

  var fstream;
  req.busboy.on('file', function (fieldname, file, filename) {

    fstream = fs.createWriteStream(__dirname + '/public/img/'+ filename);
    file.on('end', function() {
      console.log('File [' + fieldname + '] Finished sucessfully');
      console.log('fstream error' + err);
    fstream.on('close', function () {
      res.json({ message: 'File uploaded' });



This is the error i am getting

throw er; // Unhandled 'error' event
: Error: Unexpected end of multipart data
2017-05-07T20:28:27.599826+00:00 app[web.1]:     at 

For me, I received this error when I used \n newlines instead of \r\n newlines when formatting my post body on the client side.

When I fixed the newlines (as seen in code below) it worked.

  { method: 'POST',
    credentials: 'include',
    headers: {'Content-type': 'multipart/form-data; boundary=XXX' },
    body: '--XXX\r\nContent-Disposition: form-data; name="file"; filename="filename.csv"\r\nContent-Type: text/csv\r\n\r\nA,B,C\r\n1,1.1,name1\r\n2,2.2,name2\r\n\r\n--XXX--'

Error, Error definition, a deviation from accuracy or correctness; a mistake, as in action or speech: His speech contained several factual errors. See more. An error (from the Latin error, meaning "wandering") is an action which is inaccurate or incorrect. In some usages, an error is synonymous with a mistake. In statistics, "error" refers to the difference between the value which has been computed and the correct value.

This is a bug related to firebase tools. I came across this issue with busboy package today and it cost me 2hrs to fix this issue. We just need to upgrade the firebase tools to fix this issue.

Case 1: If you've installed firebase tools as your package dependency, run below code

npm i firebase-tools

Case 2: If you've installed firebase tools as global dependency,run below code

npm i -g firebase-tools

Working Version of firebase tools:

I Hope this helps, for more info checkout this issue link.

Error, Error objects are thrown when runtime errors occur. The Error object can also be used as a base object for user-defined exceptions. See below  Error, in applied mathematics, the difference between a true value and an estimate, or approximation, of that value. In statistics, a common example is the difference between the mean of an entire population and the mean of a sample drawn from that population.

If anybody else is having an issue with this still, my issue was something on the front end. Using Swift, it seems like there was an issue if you use the default URLSession config. I changed it from:

let session = URLSession(configuration: .default, delegate: self, delegateQueue: nil)

to the following:

  let sessionConfig = URLSessionConfiguration.background(withIdentifier: "it.yourapp.upload")
        sessionConfig.isDiscretionary = false
        sessionConfig.networkServiceType = .default

        let session = URLSession(configuration: sessionConfig, delegate: self, delegateQueue: OperationQueue.main)

and now it works great!

Error, something done or written by accident that is not correct, not accurate, or does not give the right result: make/introduce an error Can I amend my VAT return online  49 synonyms of errors from the Merriam-Webster Thesaurus, plus 66 related words, definitions, and antonyms. Find another word for errors. Errors: an unintentional departure from truth or accuracy.

ERROR, NounEdit. error (countable and uncountable, plural errors). (uncountable) The state, quality, or condition of being wrong. quotations ▽. 1913, The Inland printer:​. P ress the Windows key, type Network problems, and then select Identify and repair network problems in the list.; Follow the steps in the wizard to diagnose and resolve your network problems.

error, Synonyms for error at with free online thesaurus, antonyms, and definitions. Find descriptive alternatives for error. The following example uses @@ERROR with @@ROWCOUNT to validate the operation of an UPDATE statement. The value of @@ERROR is checked for any indication of an error, and @@ROWCOUNT is used to ensure that the update was successfully applied to a row in the table.

Error Synonyms, Error Antonyms, What does error mean? error is defined by the lexicographers at Oxford Dictionaries as A mistake.   The following table lists the most common upgrade and installation errors and some things you can try to fix them. If you continue having problems upgrading or installing Windows 10, contact Microsoft support.

  • Unrelated tip: never use the filename as-is. It is client-supplied and could be any value (including a malicious value that could be a relative path outside of your intended destination directory). Instead, use a random filename or even a hash of filename would be ok.
  • Thanks for the tip @mscdex
  • Am getting the exact same error using a C# client: "Error: Unexpected end of multipart data at c:\Code\NodeJSHW\node_modules\dicer\lib\Dicer.js:62:28 at _combinedTickCallback (internal/process/next_tick.js:95:7) at process._tickCallback (internal/process/next_tick.js:161:9)"