Error in S7 Tree moves

I have encountered this a couple times, the first few, I wasn’t sure what I was doing, but now I am fairly sure that the S7 Taxon tree hits a snag when trying to move (and likely also merge) nodes containing the same taxon names. For example, our tree had the same genus in 2 different places. Each had an entry the same species name (but with different authors). I want to keep both species, so I tried ‘moving’ one, so they would be within the same parent genus, and I got an error message. In S6 when I do this, I get a warning that there is already a ‘child’ with the same name, but when I confirm the move, it completes without error.

1 Like

Hi @HeatherC,

Can you share with us the name of the nodes that you tried to move? I can attempt to recreate this issue in a local copy of Specify 7.

Thank you!

just had similar error trying to add genus child to a family

Am trying to clean up " Arceuthobium". In our current tree, this genus is listed in 2 families, neither of which are currently correct.

First, I tried to move A. americanum within one instance of the genus to the other instance of the genus (sorry, can’t recall in which direction).

Then I tried adding a new instance of the genus Arceuthobium into the correct family (Santalaceae). The reason I wanted to create a new node, was to only move the taxon that are connected to records, and delete the rest that are not (vs. moving/merging at the genus level)

I just tried moving the whole genus Arceuthobium from the Viscaceae family to the Santalaceae family, and got the same error.
https://aafc-aac.specifycloud.org/specify/view/taxon/181881/

just for the heck of it, I tried using the taxon form (opened from the tree) to edit the ‘parent’ to Santalaceae, but got the error that way too.

Hi @HeatherC,

After performing the same operations while running a local database in debug mode, I see a more verbose error that points to the same underlying issue for all of these operations errors.

This seems to be specific to your database in particular. I am not able to recreate it in other similar databases, but we are looking for a solution!

You can see the full error available in this issue, but this is the actual 500 error:

AssertionError at /api/specify_tree/taxon/160170/move/
bad tree structure

I will continue my investigation. Thank you for your reports!

1 Like

darn it! I wonder if our 'cultivar(sp) and cultivar (ssp/var) ranks are messing something up? Would be happy to review how to best/better handle these ranks, but they are quite relevant to our collection which has a lot of agricultural cultivar specimens.

Another very strange behaviour that I am seeing is that I am trying to delete a node (genus) “Arceuthobium” in Loranthaceae.

I am getting blocked by messages like this

But I can manually delete that species (has no children) without an issue. Not clear why I am getting blocked from deleting the parent-genus on ‘children’ that I can delete manually. I just tried similar, and tried to delete a species (with a child) and couldn’t delete that either, without first deleting all the children…

Can confirm, after deleting all the children and children’s children manually, I was able to delete the genus.

Hi @HeatherC,

We have done some investigation into the root of this issue.


From @jason_m on GitHub:

For this case, it looks like the tree is misconfigured. There is a tree node Cornus canadensis f. dutillyi (taxonid: 18574) which has a child which is the same rank as itself.
The child is Cornus canadensis f. viride (taxonid: 186086)

SQL Command:

select t.taxonid, p.taxonid, t.fullname, p.fullname, t.parentid, p.parentid, t.rankid, p.rankid from taxon t join taxon p on t.parentid=p.taxonid where t.rankid <= p.rankid;

Result:

+---------+---------+-----------------------------+-------------------------------+----------+----------+--------+--------+
| taxonid | taxonid | fullname                    | fullname                      | parentid | parentid | rankid | rankid |
+---------+---------+-----------------------------+-------------------------------+----------+----------+--------+--------+
|  186086 |   18574 | Cornus canadensis f. viride | Cornus canadensis f. dutillyi |    18574 |    18572 |    260 |    260 |
+---------+---------+-----------------------------+-------------------------------+----------+----------+--------+--------+

The problem taxa in specify 7 and its child:

taxon_specify
/specify/tree/taxon/?conformation=%7E%7E1%7E181107%7E159752-%7E160131-%7E18522%7E18540%7E18572------

This issue is probably something they will have to fix by themselves, as their case involves a non-synonymized node. But it is a single node, so it shouldn’t be too bad to fix.

Please let me know if you need help!

1 Like

Le sigh. I am really very excellent at getting Tree-Errors :frowning:

I have tried several different actions (via S7) to clean this up. My logic attempts were

  1. create a new node, reconnect determination, delete ‘bad’ node = error on create new node. (Invalid response code 500. Expected one of 200, 201, and 409.)
  2. Determine that the correct parent node for the ‘problem child’ doesn’t exist, try to create new node = error
  3. Try to move an existing node (196946) into the bad parent (187658) = error
  4. Go to the source, try to edit the ‘bad child’ (186086) with following actions;
    • move out of its current parent (18574) to higher parent (18572)
    • edit (glitchy) taxon rank to ‘forma’
      = 15 minutes (and counting) of ‘loading’ = refreshed the page after about 20 minutes, no apparent changes.
  5. Try to ONLY change the taxon rank (to an acceptable child-rank) = error NO WAIT, just a second! This worked!
  6. Retried steps 1/2/3 above = worked!
  7. Move the ‘bad child’ to newly created correct parent = worked!
  8. Corrected the taxon rank on the child.

Lesson learned, don’t try to work get anything done in a node with sync issues.

Question; is there a way to run a check for any similar issues???

When I started this reply, I was very frustrated. I could edit it and just share my successes, but perhaps leaving up my mistakes/failures will help others to avoid them!
:smiley: :smiley: :smiley:

1 Like

Hi Heather
I am glad you finally reached a solution!

To expand upon the situation a little further, the error occurred because a Taxon record had a rank which was less then or equal to its parent.

Regarding your question,

If this issue pops up again, currently there are two solutions that come to mind.
If you have access to the database (or can have someone run SQL commands for you), you can run the SQL command below which will return all instances where a Taxon’s rank is less than or equal to it’s parent. This command specifically will return the Parent’s Full Name, Child’s Full Name, and rank of the problem child.

select p.fullname as parentFullName, c.fullname as childFullName,  def.name as rank from taxon c join taxon p on c.parentid=p.taxonid join taxontreedefitem def on c.taxontreedefitemid=def.taxontreedefitemid  where c.rankid <= p.rankid;

If you do not have access to the database, you can run a similar query in Specify 7. In the QueryBuilder in Specify 7, it is harder to accomplish the SQL command from above, and may take a little more time to go through the results. (Note that in the screenshot below, I did not include any logic of filtering cases where the child’s rank id is less or equal to its parent).
(Rank ID is a hidden field by default. You can select the field by checking the Reveal Hidden Form Fields checkbox in the Query Builder. You can additionally use the hidden Taxonomic Rank relationship, which allows you to display the name of the Taxon ranks in the Query).

We are working on a solution to eliminate those pesky 500 error messages and replace them with far more helpful information, and in this case, enough information to self-diagnose the Taxa records that are the problem, so stay tuned!

2 Likes