Hi,
I was using msprime with the msprime.SMCK and somehow ended up hitting a very weird error:
Bug detected in lib/msprime.c at line 7694. Please report this issue on GitHub, ideally with a reproducible example. (https://github.com/tskit-dev/msprime/issues)
So here I am reporting the bug.
Code to reproduce
import sys
import platform
import msprime
import daiquiri
daiquiri.setup(level="DEBUG")
import numpy as np
import tskit
print(f"Platform: {platform.platform()}")
print(f"Python: {sys.version}")
print(f"msprime: {msprime.__version__}")
print(f"tskit: {tskit.__version__}")
print(f"numpy: {np.__version__}")
print()
Ne_c = 3600
Ne_a = 10000
t0 = 30
alpha = -0.03
mutation_rate = 1e-8
recombination_rate = 1e-8
sequence_length = 2e7
sample_size = 50
ploidy = 2
demography = msprime.Demography()
demography.add_population(name="pop0", initial_size=Ne_c, growth_rate=alpha)
demography.add_population_parameters_change(time=t0, initial_size=Ne_a, growth_rate=0)
problematic_seed = 3940783591
ts = msprime.sim_ancestry(
samples={0: sample_size},
demography=demography,
recombination_rate=recombination_rate,
sequence_length=sequence_length,
random_seed=int(problematic_seed),
ploidy=ploidy,
# Both with k=0, k=1
model=msprime.SMCK(k=1),
)
print(ts.num_trees)
This example fails in the two machines I have available. That is, in macOS:
Platform: macOS-26.4.1-arm64-arm-64bit
Python: 3.12.12 (main, Dec 9 2025, 19:05:33) [Clang 21.1.4 ]
msprime: 1.4.1
tskit: 1.0.2
numpy: 2.4.4
2026-05-04 17:19:23,617 [41659] INFO msprime.ancestry: Sampling 50 individuals with ploidy 2 in population 0 (name='pop0') at time 0
2026-05-04 17:19:23,619 [41659] INFO msprime.ancestry: Starting replicate 0
2026-05-04 17:19:23,619 [41659] INFO msprime.ancestry: model[0] {'name': 'smc_k', 'k': 1.0} started at time=0 nodes=100 edges=0
2026-05-04 17:19:23,619 [41659] INFO msprime.ancestry: Running model {'name': 'smc_k', 'k': 1.0} until max time: inf
2026-05-04 17:19:23,668 [41659] DEBUG msprime.ancestry: time=554.851 ancestors=3239 ret=1
2026-05-04 17:19:23,713 [41659] DEBUG msprime.ancestry: time=1491.18 ancestors=3753 ret=1
2026-05-04 17:19:23,749 [41659] DEBUG msprime.ancestry: time=3131.51 ancestors=3985 ret=1
2026-05-04 17:19:23,779 [41659] DEBUG msprime.ancestry: time=6154.73 ancestors=4027 ret=1
2026-05-04 17:19:23,806 [41659] DEBUG msprime.ancestry: time=11301.7 ancestors=4099 ret=1
2026-05-04 17:19:23,831 [41659] DEBUG msprime.ancestry: time=19977.2 ancestors=4015 ret=1
2026-05-04 17:19:23,852 [41659] DEBUG msprime.ancestry: time=34372.7 ancestors=3771 ret=1
Bug detected in lib/msprime.c at line 7694. Please report this issue on GitHub, ideally with a reproducible example. (https://github.com/tskit-dev/msprime/issues)
and in Fedora:
Platform: Linux-5.14.0-611.24.1.el9_7.x86_64-x86_64-with-glibc2.34
Python: 3.14.0 (main, Oct 28 2025, 12:13:17) [Clang 20.1.4 ]
msprime: 1.4.1
tskit: 1.0.2
numpy: 2.4.4
2026-05-04 16:35:38,492 [2424697] INFO msprime.ancestry: Sampling 50 individuals with ploidy 2 in population 0 (name='pop0') at time 0
2026-05-04 16:35:38,495 [2424697] INFO msprime.ancestry: Starting replicate 0
2026-05-04 16:35:38,496 [2424697] INFO msprime.ancestry: model[0] {'name': 'smc_k', 'k': 1.0} started at time=0 nodes=100 edges=0
2026-05-04 16:35:38,496 [2424697] INFO msprime.ancestry: Running model {'name': 'smc_k', 'k': 1.0} until max time: inf
2026-05-04 16:35:38,588 [2424697] DEBUG msprime.ancestry: time=554.851 ancestors=3239 ret=1
2026-05-04 16:35:38,664 [2424697] DEBUG msprime.ancestry: time=1491.18 ancestors=3753 ret=1
2026-05-04 16:35:38,724 [2424697] DEBUG msprime.ancestry: time=3131.51 ancestors=3985 ret=1
2026-05-04 16:35:38,776 [2424697] DEBUG msprime.ancestry: time=6154.73 ancestors=4027 ret=1
2026-05-04 16:35:38,822 [2424697] DEBUG msprime.ancestry: time=11301.7 ancestors=4099 ret=1
2026-05-04 16:35:38,863 [2424697] DEBUG msprime.ancestry: time=19977.2 ancestors=4015 ret=1
2026-05-04 16:35:38,900 [2424697] DEBUG msprime.ancestry: time=34372.7 ancestors=3771 ret=1
Bug detected in lib/msprime.c at line 7694. Please report this issue on GitHub, ideally with a reproducible example. (https://github.com/tskit-dev/msprime/issues)
Hi,
I was using
msprimewith themsprime.SMCKand somehow ended up hitting a very weird error:So here I am reporting the bug.
Code to reproduce
This example fails in the two machines I have available. That is, in macOS:
and in Fedora: