# An error occurred while generating the contract from a data

**URL:** <https://community.ofelia.com/t/an-error-occurred-while-generating-the-contract-from-a-data/11043>\
**Category:** Q&A\
**Created:** [20 December 2021 16:11 UTC](https://community.ofelia.com/t/an-error-occurred-while-generating-the-contract-from-a-data/11043 "2021-12-20T16:11:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdubois](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@jdubois](https://community.ofelia.com/u/jdubois)\
**Post date:** [20 December 2021 16:11 UTC](https://community.ofelia.com/t/an-error-occurred-while-generating-the-contract-from-a-data/11043/1 "2021-12-20T16:11:01Z")

</div>

Dear Bonitasoft: I am a very new user to this software.&nbsp; I am running Bonitasoft Community 2021.2 on Windows 10.&nbsp; I am working through the getting started tutorial and in the section where one declares contracts.&nbsp; I have followed the directions up to Execution \> Contracts \> Add from data.&nbsp; A pop window comes up "Select claim attributes to add to contract" wherein I select "description" only and when I click on finish I get the error "An error while generating the contract from a data" appears.&nbsp; The details of the error are below.&nbsp; Any help you can offer would be greatly appreciated.&nbsp; Thank you.

&nbsp;

- An error occurred while generating the contract from a data.  
 org.bonitasoft.studio.groovy.GroovyCompilationUnitFactory.newCompilationUnit(GroovyCompilationUnitFactory.java:43)  
 org.bonitasoft.studio.contract.core.mapping.expression.FieldToContractInputMappingExpressionBuilder.groovyCompilationUnit(FieldToContractInputMappingExpressionBuilder.java:130)  
 org.bonitasoft.studio.contract.core.mapping.expression.FieldToContractInputMappingExpressionBuilder.addScriptDependencies(FieldToContractInputMappingExpressionBuilder.java:106)  
 org.bonitasoft.studio.contract.core.mapping.expression.FieldToContractInputMappingExpressionBuilder.toExpression(FieldToContractInputMappingExpressionBuilder.java:72)  
 org.bonitasoft.studio.contract.core.mapping.expression.FieldToContractInputMappingExpressionBuilder.toExpression(FieldToContractInputMappingExpressionBuilder.java:62)  
 org.bonitasoft.studio.contract.core.mapping.RootContractInputGenerator.buildInitialValueExpression(RootContractInputGenerator.java:85)  
 org.bonitasoft.studio.contract.core.mapping.RootContractInputGenerator.buildForInstanciation(RootContractInputGenerator.java:69)  
 org.bonitasoft.studio.contract.ui.wizard.ContractInputGenerationWizard.lambda$0(ContractInputGenerationWizard.java:229)  
 org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [9 February 2022 19:44 UTC](https://community.ofelia.com/t/an-error-occurred-while-generating-the-contract-from-a-data/11043/2 "2022-02-09T19:44:31Z")

</div>

The issue that you are observing probably happened when you select/deselect fields that are defined as mandatory in the business data. Something was mixed up there.&nbsp;Make sure the contract with the mandatory attributes matches the automatically generated scripts to initialize the business variable, and update the atributes from&nbsp;the contract. Anyway,&nbsp;something is most likely wrong with your mandatory attribute.
