SOLVED

Bulk Lead Import 1006 error

Go to solution
Worcesterharry
Level 2

Bulk Lead Import 1006 error

Hello everyone,

 

I'm trying to use the bulk lead import endpoint to update leads. I've experimented with Zapier also n8n for this purpose because of the tricksyness of multipart/form-data. I use Zapier with the files endpoint to create CSVs in the Design Studio with no issues so I thought it would work for this purpose also.

 

I get a 1006 error back saying "Header field 'email' not found". Just in case I was supposed to use SOAP I also tried "Email" in the file but same message. Obviously email is a field that exists in Marketo so does anyone know what is happening or have a better method? I know I must be misunderstanding how form data works so even if someone could explain the difference between the files endpoint and bulk lead endpoint and why one works with ipaas and the other doesn't that would be a huge help.

 

This is what I'm sending with an example file:
Webhook.site - Test, process and transform emails and HTTP requests

 

Thanks in advance, guys.

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Bulk Lead Import 1006 error

Make sure you’re not including the BOM (Byte Order Mark) EF BB BF just before the 1st line (i.e. the header line).

 

It looks like you may be loading a CSV file from disk that has a BOM and including it directly in the MIME part. This won’t work because the EF BB BF will be interpreted as those literal characters (i.e. not the special symbol that’s discarded after it’s parsed). The name of the header field then becomes the three characters followed by the letters “email”:

ef bb bf 65 6d 61 69 6c	    . . . e m a i l

 

You would not notice those non-printable characters in the error response, in other words it’s not saying ‘email’ is not found but ‘\EF\BB\BFemail’ not found.

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Bulk Lead Import 1006 error

That test site doesn’t appear to show the full, raw payload put on the wire. Please post to my test server and I’ll take a look (PMing you the URL).

SanfordWhiteman
Level 10 - Community Moderator

Re: Bulk Lead Import 1006 error

Make sure you’re not including the BOM (Byte Order Mark) EF BB BF just before the 1st line (i.e. the header line).

 

It looks like you may be loading a CSV file from disk that has a BOM and including it directly in the MIME part. This won’t work because the EF BB BF will be interpreted as those literal characters (i.e. not the special symbol that’s discarded after it’s parsed). The name of the header field then becomes the three characters followed by the letters “email”:

ef bb bf 65 6d 61 69 6c	    . . . e m a i l

 

You would not notice those non-printable characters in the error response, in other words it’s not saying ‘email’ is not found but ‘\EF\BB\BFemail’ not found.

Worcesterharry
Level 2

Re: Bulk Lead Import 1006 error

This is absolutely the issue-- @SanfordWhiteman strikes again, thank you so much.

 

So for future people trying to do the same thing: in Zapier instead of using the actual file in the webhook task "file" field, you need to format your data for csv - so comma-delimited values with a CRLF at the end of each row. Check out this thread for the simplest method I could find without too much code.

 

For n8n I'm not sure yet, solution will be here if I find it.

 

EDIT: for n8n I ended up having to use the lead endpoint rather than bulk import and just batching and looping till done. It will work though, but obviously avoid for larger amounts of data. Solution is in the linked thread.

SanfordWhiteman
Level 10 - Community Moderator

Re: Bulk Lead Import 1006 error

Sounds good, I’m going to write a blog post about this situation and exactly how it comes about.

 

P.S. The reason this isn’t a problem when writing Design Studio assets via the API is that in that case you’re reading and writing the binary file regardless of its contents. It’s not being parsed at an intermediate step, so it can have the BOM at both the source and the destination.