Skip to content

UK /calculate returns 500 in production: Simulation.__init__() got an unexpected keyword argument 'tax_benefit_system' #1601

Description

@PavelMakarchuk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions