You are viewing limited content. For full access, please sign in.

Question

Question

cf_bp_attachment_data' failed because another entity of the same type already has the same primary key value

asked on August 16, 2021

Process getting terminated at a user task. Error is given below. This process has been working without any issues, but recently two got terminated. There are two upload fields in this form, one required and one not required.

  • Inner exception: System.InvalidOperationException Message: Attaching an entity of type 'Laserfiche.Forms.EntityModels.cf_bp_attachment_data' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate. at System.Data.Entity.Core.Objects.ObjectContext.VerifyRootForAdd(Boolean doAttach, String entitySetName, IEntityWrapper wrappedEntity, EntityEntry existingEntry, EntitySet& entitySet, Boolean& isNoOperation) at System.Data.Entity.Core.Objects.ObjectContext.AttachTo(String entitySetName, Object entity) at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName) at System.Data.Entity.Internal.Linq.InternalSet`1.Attach(Object entity) at System.Data.Entity.DbSet`1.Attach(TEntity entity) at Laserfiche.Forms.EntityModels.cf_bp_attachment_data.AttachToOrGet(IFormsEntities db, cf_bp_attachment_data& attachmentStub) at Laserfiche.Forms.Routing.FlowObject.AddSubmissionData(IEntityContext appContext, cf_submissions submission, SubmissionAttributeData[] attributeDataSet, SubmissionHeaderData submissionHeaderData) at Laserfiche.Forms.Routing.Activity.ProcessSubmissionDataForNewSubmission(SubmissionHeaderData submissionHeaderData, SubmissionAttributeData[] submissionAttributeDataSet, cf_submissions submission) at Laserfiche.Forms.Routing.Activity.UpdateDataForMainProcessInstance(cf_bp_worker_instances processInstance, IRoutingContext routingContext) at Laserfiche.Forms.Routing.UserTask.ExecuteForReEntry(cf_bp_worker_instances processInstance, IRoutingContext routingContext) at Laserfiche.Forms.Routing.UserTask.Execute(Int32 instanceId, IRoutingContext routingContext) at Laserfiche.Forms.Routing.RoutingDispatcher.ExecuteStep(KeyValuePair`2 currentStep, Exception& executionException)

Close

Cannot figure out what the issue could be. Will appreciate your help.

 

0 0

Replies

replied on August 16, 2021

Hi Binu,

What version of Forms are you using? We've seen this error before and it should be fixed in Forms 11.

0 0
replied on August 18, 2021

We have  version10.4.5.282.

Could you please share why and when it is happening? 

0 0
replied on August 18, 2021

Sure. The error happens when the value of file upload field in submission has duplicate attachment id, which is unexpected during processing. While the reason why it has duplicate attachment id is unknown according to previous investigation. 

 

Please open a support case with your VAR for this if you'd like to resume related terminated instances.

1 0
replied on December 7, 2021

Was their a resolution to this issue?

0 0
replied on December 21, 2021

Not yet.

0 0
replied on April 15, 2022

If you see the same error, you can upgrade to the latest Forms 11 which has better handling to ignore the duplicated attachment ids to avoid terminte the instance.

1 0
replied on April 15, 2022 Show version history

This bug has been fixed in Forms 11 as well as Forms 10.4.4 Update 1(https://support.laserfiche.com/kb/1014320/list-of-changes-for-laserfiche-forms-10-4-4-update-1)

You are not allowed to follow up in this post.

Sign in to reply to this post.