Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

bootstrap with mh or am is accepted at load, then crashes with a TypeError when the first replicate starts, after the whole main fit has run

Open Beginner friendly
#935 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start with bootstrap handling at pybnf/pybnf.py:521 and the sampler reset methods in basic_mcmc.py:101 and adaptive_mcmc.py:165. Trace how base.py:379 opens samples_file during start_run, then check configuration loading for a validation path. Done means unsupported sampler bootstrapping is rejected before the main fit runs, including mh, am, and pt, with coverage for the reported configuration.

Written by the indexing model from the issue text.

Description

bug

The configuration accepts bootstrap = N with job_type = mh or job_type = am. The main fit then runs to the end and writes its results. When the first bootstrap replicate starts, the run stops with Sorry, an unknown error occurred: TypeError: expected str, bytes or os.PathLike object, not NoneType. No replicate is fitted, and the error appears only after the whole main fit has run.

pt shares mh's code and should crash the same way; I did not run it. #862 covers dream and p_dream, where bootstrap runs but each replicate's result is wrong.

Example

boot.conf needs no model or data file:

edition = 2
objective = expression
expression = 0.5*((x - 1)/0.5)^2 + 0.5*((y - 3)/0.5)^2
job_type = mh
uniform_var = x -5 5
uniform_var = y -5 10
max_iterations = 100
burn_in = 50
sample_every = 1
population_size = 2
random_seed = 1
bootstrap = 2
output_dir = out

Run pybnf -c boot.conf -o. It prints Fitting complete, then Beginning bootstrap run 0, then the TypeError, and exits with code 1. job_type = am (with adaptive = 20 added) does the same.

Where in the code

  • pybnf/pybnf.py:521: alg.reset(bootstrap=...) runs before each replicate.
  • pybnf/algorithms/samplers/basic_mcmc.py:101 (mh, pt) and pybnf/algorithms/samplers/adaptive_mcmc.py:165 (am): reset() sets self.samples_file = None.
  • pybnf/algorithms/samplers/base.py:379: the replicate's start_run then opens samples_file to write its header, and gets None.

Unless bootstrapping a sampler is meant to be supported, the simplest fix is to refuse bootstrap for every sampler job_type when the configuration loads. That would also cover #862.

Dominant language
Python
Stars
25
Forks
25
Avg merge
2h 38m
Merged PRs (30d)
98

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lanl/PyBNF

All issues in lanl/PyBNF

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.