M2Doc technical error : Index 0, Size 0

Hi,
whenever I command a document generation by clicking on “Generate Documentation” I get the error message below with the details also pictured below.
This happened before but the problem went away without any special action from me. This time the problem persits although I have closed everything, restarted the computer and deleted the old generated docx.
Do you guys have any clue what might be happening?
I’m using M2Doc v2.0.3 with Capella v1.3.1 and PVMT v44.4.2
Edit: I don’t know if it is related but in the folder where my template is stored a debug.log file was created about the time M2Doc started returning errors.
The content of debug.log is:
[0326/174655.395:ERROR:registration_protocol_win.cc(84)] TransactNamedPipe: The pipe has been ended. (0x6D)

2020-03-26 18_03_40-workspace - Capella.png
2020-03-26 18_03_40-workspace - Capella.png

Hi Fabio,
Not a solution but could you also provide the error log file ?
Stephane

Hi Stephane!
I searched for the error log and all I could find in my workspace that seemed like an error log was in the .metadata folder in the workspace root with the name ‘.log’.
I’ve attached it to thist post.
It seems the log regarding the errors on M2Doc generation is in the following lines:
!ENTRY org.obeonetwork.m2doc.genconf.editor 4 4 2020-03-26 20:34:00.900
!MESSAGE M2Doc : technical error : Index: 0, Size: 0
!STACK 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at java.util.Collections$UnmodifiableList.get(Unknown Source)
at org.obeonetwork.m2doc.util.M2DocUtils.parseTemplateCustomProperties(M2DocUtils.java:491)
at org.obeonetwork.m2doc.util.M2DocUtils.parse(M2DocUtils.java:444)
at org.obeonetwork.m2doc.genconf.GenconfUtils.generate(GenconfUtils.java:483)
at org.obeonetwork.m2doc.genconf.GenconfUtils.generate(GenconfUtils.java:420)
at org.obeonetwork.m2doc.genconf.editor.command.GenerateHandler$GenerateJob.runInWorkspace(GenerateHandler.java:86)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

.log
.log

Thanks Fabio, that’s the file
I pinged the m2doc team, hopefully they can provide an answer quickly.
Would you also share your m2doc template in case it is needed?
Stephane

Thanks for your effort Stephane! I have defaced the document maintaining only the tags used by M2Doc and the problem remains so I believe it is still representative. Find it attached below;

InterfaceGen.docx
InterfaceGen.docx

After looking at M2Doc code, it seems that one of the metamodel your are using can’t be found. Your should open the template properties using the
wizard and in the nsURI tab make sure all the metamodel you are using are available.
I see a lot imported metamodels, you should probably remove some of them. A good starting point is probably to keep capella and sirius and maybe thales also. From here see if the template works or if it complains about missing types and add metamodels accordingly.
I don’t have the same environment as you so I can’t tell which one exactly.

Thank you for the answer It works! Removing all the elements from the nsURI tab and readding the ones you mentioned made it work but now I’m getting a validation error.
The output generated seems OK but I don’t know if the validation error is serious. InterfaceGen.validation.docx has these error messages in two tags:
{m:ce.source.eContainer().name <— Feature name not found in EClass EAnnotation Feature name not found in EClass DAnalysisCustomData Feature name not found in EClass ToolGroupInstance Feature name not found in EClass AnnotationEntry Feature name not found in EClass EValue}
{m:ce.target.eContainer().name <— Feature name not found in EClass EAnnotation Feature name not found in EClass DAnalysisCustomData Feature name not found in EClass ToolGroupInstance Feature name not found in EClass AnnotationEntry Feature name not found in EClass EValue}

At this point ce.target can be contained in an element of type EAnnotation, DAnalysisCustomData, ToolGroupInstance, EClass AnnotationEntry, EValue, or … and those EClasses don’t have a feature name meaning calling .name could cause an error at runtime.
If you know the type you expect you can specify it like this:
{m:ce.source.eContainer().oclAsType(pkg::MyEClass).name}
Of course MyEClass should have a feature name.