[SalesForce] “lighning:recordEditForm” Not able to create a record if master-detail relationship field is present

I am facing a strange issue.
I am trying to create a record using lightning:recordEditForm but not able to create a record.
I have a master detail relationship field "Account" on object "Book". When I have changed the relation to lookup it is working. But for master detail relationship it is not working. Please help me.

Below is the code

<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">
     <aura:attribute name="recordId" type="Id"/>

    <lightning:recordEditForm  objectApiName="Book__c">
        <lightning:messages />
        <lightning:inputField fieldName="Name" />
        <lightning:inputField fieldName="Account__c"/>

        <lightning:button class="slds-m-top_small" type="submit" label="Create" />
    </lightning:recordEditForm>

</aura:component>

This is the error I am getting
enter image description here

Best Answer

Appears to be a combination of a bad error message (you are creating not updating) and a limitation of the recordEditForm component. The Component does not appear to handle the condition when you are creating the Detail record in a Master/Detail relationship. One workaround is if you are able to set the Master/Detail field to "reparentable", then the component seems to work.