"Handle is empty"... but where?

Today, while trying an experiment importing the Reunion .ged file from @Seagram , Gramps 5.2.2 started giving the following message in the Terminal:
⚠ Warning: Handle is empty

But the warning did not including any context. Is there a hack to indicate what was trying to use the empty handle?

(I think that the empty handle warning was due to a new tree import not having active records. And it appears when switching to a view that has no active record.)

Here’s where that warning is generated:

A similar thread is about the adjacent warning in generic.py. But in their case, there was enough extra context to begin diagnostics:

Is the gedcom file available somewhere? If so I can run it in the debugger and hopefully find where the error is generated.

The warning is not specific to that GEDCOM data file. If you start from the terminal, create a new tree and import the “sample.ged” file (in “example/gedcom”, bundled with Gramps), the symptom is the same. You just have to click through the various categories of the Navigator sidebar.

The warning appears to be because that importing a file does not make certain that there is an active record in each category. And does not set a Home Person. But most views need an active record to feed the Gramplets and a Home Person for most relationship features.

So the views complain if a Record is not active. This is a transitory condition that generally only affects brand new users. Because it is hard to NOT have active records if you’ve been using the software … even for a few minutes. So adding extra code to “setting active records in all categories by default” is probably of little interest to experienced developers.

However, the real issue is that the warning is not actionable. (I assume that there will be other circumstances that could cause this warning code to be used.) The text of the warning does not give enough of a clue about what caused the warning nor how to resolve an “empty handle”. It looks like there is damage to a particular object in the tree data. But it is just a missing selection in the GUI.

@emyoulation thanks for the extra information. I think I’ve followed your instructions but I’ve not been able to recreate this so far. Here’s what I did in case I missed something

  1. start Gramps
  2. create a new (empty) family tree and load it
  3. Family Trees > Import…
    Choose the sample.ged file
  4. Click Close in the statistics and gedcom import report dialogs
  5. click each of the views from the left hand navigator bar

The only message I see in the terminal comes from OsmGpsMaps.
I tested on Windows using the official Gramps 6.0.1 release and the latest development code.

Do you have any gramplets displayed? That’s the only difference I can think of.

Gramplets sound very likely! Thanks!

Will investigate more in the morninng (after waking up for real).

But if that turns out to be the problematic code, it underlines the need for the warning to be more informative.