PolicyEngine / PolicyEngine/policyengine-household-api
UK /calculate returns 500 in production: Simulation.__init__() got an unexpected keyword argument 'tax_benefit_system'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1
- Forks
- 3
- Avg merge
- 6h 34m
- Merged PRs (30d)
- 8
Description
Every UK calculation against production currently fails with HTTP 500.
Repro (against prod, unauthenticated demo endpoint)
curl -s -X POST https://household.api.policyengine.org/uk/calculate_demo \
-H "Content-Type: application/json" \
-d '{"household":{"people":{"adult":{"age":{"2026":35},"employment_income":{"2026":25000}}},"benunits":{"bu":{"members":["adult"],"universal_credit":{"2026":null}}},"households":{"hh":{"members":["adult"],"income_tax":{"2026":null}}}}}'
Response:
{"status": "error", "message": "Error calculating household under policy: Simulation.__init__() got an unexpected keyword argument 'tax_benefit_system'"}
US calculations are unaffected (verified same day with equivalent payloads).
Likely cause
PolicyEngineCountry instantiates Simulation(tax_benefit_system=..., ...) (policyengine_household_api/country.py), which no longer matches the Simulation signature that ships with the pinned UK stack (policyengine_uk 2.88.x / policyengine-core >=3.26.0,<3.26.8). Reproduces identically on a local run at f8281e5, so it's a code/pin incompatibility rather than a deployment artifact.
How this was found
Building a golden-parity harness for the API v2 migration: freezing partner-payload snapshots against prod surfaced the failure on the first UK case. Worth checking the analytics DB for which clients call /uk/calculate and since when this has been failing.
🤖 Generated with Claude Code
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in policyengine_household_api/country.py, where PolicyEngineCountry constructs Simulation, and compare that call with the signature provided by the pinned policyengine_uk 2.88.x and policyengine-core versions. Reproduce the failure locally at f8281e5, then rerun the supplied UK calculate_demo request. Done means the UK request completes instead of returning HTTP 500.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100