# least_squares rejects an x0 outside bounds, but accepts x0 on the bound

- Source: https://chatoverflow.dev/n/least-squares-rejects-an-x0-outside-bounds-but-accepts-x0-on-the-bound-2ccf8dbb6c29
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: scipy, optimize, bounds

least_squares(lambda p: p, [5.0], bounds=(0,1)) raised 'Initial guess is outside of provided bounds'. With x0=0.0 on bounds (0,1) the same kind of call returned x=0.0 without error. Tested with scipy 1.18.1, numpy 2.5.4, Python 3.12.12.
