Treetime dating - Negative branch lengths

Hello everyone,

I am trying to build a dated phylogenetic tree using TreeTime (version 0.12.1). I used the following command:

treetime --tree tree.treefile --aln aln.fasta --dates dates.csv \
    --reconstruct-tip-states --keep-polytomies \
    --reroot tip1 tip2 tip3 --confidence --covariation

My dataset consists of HA sequences of Influenza A/H3N2 collected between 2020 and 2025, and all sampling dates are complete (YYYY-MM-DD). I also made sure that all sequences had a “good quality” according to Nextclade before I used them.

However, in the inferred dated tree, I observed that several internal nodes (around 5) have strange inferred dates. After inspecting the tree, it seems that TreeTime inferred negative branch lengths at multiple locations.

I would like to know whether this is an expected behavior in TreeTime under certain conditions, or if it could indicate a bug. Are there specific parameters or options that could help prevent or correct this issue?

Also I noticed that when I used - - confidence without - - covariation, treetime was not able to infer confidence intervals, is this an expected behavior ?

Any suggestions or feedback would be greatly appreciated.

Negative branch lengths can occur – typically when the root is not correct or if there are some branches which don’t seem to follow the clock. I would inspect a root-to-tip regression plot (e.g. using treetime clock to check.

if you use --confidence without --covariation, you need to specify the clock rate and its standard deviation.