Skip to content

Beauti: Tip dates -> Clone from causes NullPointerException when trees are linked #171

Closed

Description

@NicoNeureiter

When trying to Clone from in the Tip dates panel, Beauti seems to attmept copying the wrong partition. This becomes apparent when some partitions share the same tree, leading to a NullPointerException. This seems to affect the current 2.8 version, but also previous version (tested on 2.7.8).

Steps to reproduce

  1. Import two alignments, split both by codon position (trees are linked within each alignment).
  2. Tip Dates tab → select both partitions → Clone from.

Result

Nothing is cloned, and:
java.lang.NullPointerException: Cannot invoke "beast.base.evolution.tree.TreeInterface.getID()" because "tree" is null
at beastfx.app.inputeditor.BeautiPanel.cloneFrom(BeautiPanel.java:481)
at beastfx.app.beauti.ClonePartitionPanel.clonePartitions(ClonePartitionPanel.java:60)

Cause

cloneFrom computes source/target as indices into doc.getPartitions(type)
(= pPartition[i]) but dereferences them against likelihoods.pDistributions.get().
pPartition[i] is deduplicated by model (BeautiDoc.java:2108-2117); pDistributions holds
every likelihood. Unlinked they coincide, so the bug is invisible; linked they diverge and the
wrong likelihood is selected. It then shares the source's tree, so renameId maps the tree id
onto itself, the guard at BeautiDoc.java:2361 skips it, deepCopyPlugin returns null
(:2473), and cloneFrom dereferences it. The filtered list is always shorter, so the bad
index never goes out of bounds — it just picks the wrong element.

Suggested fix

In BeautiPanel.java lines 413-414:

GenericTreeLikelihood likelihoodSource = (GenericTreeLikelihood) list.get(source);
GenericTreeLikelihood likelihood = (GenericTreeLikelihood) list.get(target);

Activity

  1. NicoNeureiter commented on Sep 28, 2026

    @NicoNeureiter
    CollaboratorAuthor

    Solved with the suggested fix (PR #172 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions