Error inserting a record-Reference Field field_name not having the value 0.

Error inserting a record-Reference Field field_name not having the value 0.

I'm inserting a record with a function. I'm getting the error Reference Field Field_name not having the value 0. Field_Name is a lookup field but it is not required. The funny thing is I still get the error if the field is not referenced in the insert section. I also get the error if the field is in the insert section with a valid value.