Archi Forum

Archi => General Archi Discussion => Topic started by: Alberto on August 26, 2019, 21:14:07 PM

Title: Error: Diagram with Orphaned Element
Post by: Alberto on August 26, 2019, 21:14:07 PM
Something happened when I dropped an element on a view, I then got some Java error that made it unclickable anymore.  I tried to undo, nothing happened, closed and tried to open the view, got a NullPointerException, tried to save to a different file, I got this error.

I recently installed Herve's alpha version of the specialization tool, which I think caused the java to bug out, but I would like to be able to fix the archi model and not lose the work I did already, then deal with the plugin later.  Any ideas how to go under the hood of an open model to hunt and kill the 'rogue' element?

Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 26, 2019, 21:18:27 PM
If you can remember the exact steps that led to the problem that would be useful to know. I'd be interested to know if it is an Archi issue or caused by the plug-in.

Do you have a *.bak file of the model?

If not, you can send it to me by email and I can fix it, assuming it's not confidential.
Title: Re: Error: Diagram with Orphaned Element
Post by: Hervé on August 26, 2019, 21:30:08 PM
Hi Alberto,

If I understand correctly, you cannot save your model as you're experiencing the error message you sent.

Do you have the jArchi plugin installed ? We may use it to try to remove the "CCure / DSR (AS IS) (Servers) (copy)" from the view.

Best regards
Hervé
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 26, 2019, 21:31:37 PM
Hervé, it might be quicker for me to do surgery on the model...  8)
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 26, 2019, 21:48:30 PM
It's a repo file.  The bak and temp files are from my previous save.  It's also my main model so it does have some sensitive info on our security infrastructure.

I do have jArchi installed and I'm looking to see if I can identify it that way, but I'm no programmer so I'm still on the JS learning curve.  Could I delete the element from the view that way? At least I have the UUID
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 26, 2019, 21:51:04 PM
I also have the database plugin installed... would that be easier?
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 26, 2019, 21:57:08 PM
The error message means that a diagram object has been orphaned from the model structure somehow. A diagram object has a parent object which is the diagram itself ("View"), and this View has a Folder as a parent until it reaches the model itself:

Model
    Views Folder
         View (Diagram)
              Diagram Object

Somewhere that chain is broken. Did you make a copy of the View just before the error? Perhaps the View is orphaned. Or perhaps a sub-folder is orphaned.

Perhaps a folder was moved or renamed? There is a known issue to do with folders and the collaboration plug-in (I need to remind myself what causes it... JB knows)

I don't think you'll easily fix it with jArchi or db plugin.

As it's in a repo, is there a previous commits you could go back to?
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 26, 2019, 22:10:26 PM
I used the database plugin to upload the model and found the object_id in the views_objects_in_view table.  I wonder if I can delete the row from the table  ??? I'm in the 'let's see what happens if I press this button' territory.

I don't see the uuid listed anywhere else so not sure if it uploaded the whole thing, my Archi client is a bit buggy right now so I don't trust it

I have the repo from this morning, so worse comes to worse I loose a day's worth of work... not terrible but that means a long night tonight as my mgr wants these for tomorrow.
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 26, 2019, 22:14:27 PM
There are so many variables at work here (collaboration plugin, db plugin, alpha specialization plugin) that I can't fix this at a distance. I can't advise on Herve's plugins, either.

If I were to look at the *.archimate file I could probably salvage it but that's an option that you can't pursue.
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 26, 2019, 22:19:01 PM
Yes, I made a copy of the view, and I believe the uuid in the error is related to the copy.

I know, I got a few things going on, I've been using Archi quite extensively and honestly this is the first bug I encounter, so don't sweat it Phil. I'll blame it on Herve  ;D

Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 26, 2019, 22:20:33 PM
I'm interested to know if there's any bug related to copying a view. BTW - what version of Archi is this?
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 26, 2019, 22:25:29 PM
v4.5.1
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 26, 2019, 22:29:23 PM
You can view the *.archimate file in a text editor and find the xml tag that has that ID and see if it has a parent xml tag. If it does then see if the parent has a parent...

<model>
   <"views" folder>
        <view>
             <diagram_object>
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 26, 2019, 22:33:48 PM
I found the Archi logs.  Attached for the curious but I think I'm calling it a day and start over tonight. 

Thanks Phil (and Herve)
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 26, 2019, 22:38:43 PM
Actually, I just checked again. It's not the diagram object that is orphaned but the element that it references that is orphaned.

So you need to find the diagram object by its ID and then look for the archimateElement="ID" part and then find that element by its ID. If you can't find it then the diagram object tag needs to be deleted. But this can get complicated if this is attached to something else...

Note: the model checker checks the integrity of the model each time it is saved. If a problem is found, you are not allowed to save the model. This is intentional so that you don't save a model that has lost its integrity. So, if this ever happens, note the error message and quit Archi without saving the model. Restart and load the model again. Try to re-save after a modification. If there is still a problem, then the issue must have arisen somewhere else.
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 27, 2019, 10:20:37 AM
A possible case where a model might lose its integrity is with jArchi where one might re-use an object that was deleted from the model in an earlier jArchi operation. There are some checks for this in jArchi, but there may be a case where it happens. When using jArchi, it's best to make a backup first.
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 27, 2019, 13:03:08 PM
Herve, I'm sorry to say that I had the same issues last night as I worked on recreating my work (this time saving often). I ran into the issue again, and then I was able to recreate it a couple more times. Adding a new element would corrupt the model. The issues went away when I removed the 2.0alpha specialization plugin. It looks like a similar issue that rchevallier raised here: https://forum.archimatetool.com/index.php?topic=677.msg3994

The file I had downloaded from July (but not installed) was 3,461,690 bytes (3,465,216 bytes on disk) which is not the same as 3,461,675 bytes that you have listed. I just downloaded a new one and it's 3,461,690 bytes (3,469,312 bytes on disk).  They both had the same effect, adding a new element would corrupt my model.

Let me know if there's anything I can do to gather details for you.
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 27, 2019, 13:07:14 PM
Alberto, what are the exact steps that cause the error? Are you 100% sure that it is caused by Herve's plug-in.?

I'm interested to know this so I can double-check the core Archi code.
Title: Re: Error: Diagram with Orphaned Element
Post by: Hervé on August 27, 2019, 15:35:47 PM
Hi Alberto,

My apologies, I'm very busy these days and was not available very much for your issue :-[

In addition, I haven't had time to switch to Archi 4.5 yet so couldn't had a chance to test my plugins against this new release. I tried few things to try to reproduce your issue with Archi 4.4 but I never experienced your issue.

Anyway, what would help me is to have a detailed procedure on how to reproduce the issue. I can install Archi 4.5 on a test machine and run tests in debug mode and fix my plugin (if it comes from it).

Thanks
Hervé
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 27, 2019, 16:05:10 PM
Hi Herve,
No worries, I removed the alpha plugin and everything went back to normal, so the issue is definitively with the alpha version. I tried installing it both on the plugins and the dropins folders and it just wouldn't work even with a blank model. Even settings the preferences are missing (see attached) and setting the logs to Advance don't seem to do anything so I can't get you logs.  I just tried your latest v1 version and that seems to works fine with Archi 4.5.1. 

I use Win10 Enterprise.  I'll test my home machine and my test VMs at home later this week and let you know.

PS. the error message on the screenshot is when I tried to check for new versions.
Title: Re: Error: Diagram with Orphaned Element
Post by: Hervé on August 27, 2019, 16:48:40 PM
Even without any log file, are you able to give me a list of actions that I can follow in Archi to reproduce your issue on my desktop and debug my plugin ?

At the moment, as I failed to reproduce your error, it's quite difficult to investigate ...
Title: Re: Error: Diagram with Orphaned Element
Post by: Phil Beauvoir on August 27, 2019, 16:50:41 PM
And we need to be 100% certain that the error does not happen when this alpha plug-in is not installed.

We need to eliminate other possible causes - Archi itself, jArchi, Collaboration plug-in, DB plug-in...
Title: Re: Error: Diagram with Orphaned Element
Post by: Alberto on August 27, 2019, 18:03:02 PM
I will later this week, need to get thru work first and then will get to replicate and document the issue.