claude-memory/graph/errors/critical-wrong-api-parameter-name-used-dem-week-instead-of-d-0d5b86.md
Cal Corum b140d4d82a migrate: 313 memories from MemoryGraph
- 313 new markdown files created
- 30 relationships embedded
- 313 entries indexed
- State initialized with usage data
2026-02-13 11:11:48 -06:00

50 lines
2.1 KiB
Markdown

---
id: 0d5b864a-7787-4ee5-841d-b8b1556d6425
type: error
title: "Critical: Wrong API parameter name - used 'dem_week' instead of 'demotion_week'"
tags: [major-domo, python, api, parameter-naming, production, critical]
importance: 0.9
confidence: 0.8
created: "2026-02-02T03:29:04.489436+00:00"
updated: "2026-02-02T03:29:04.489436+00:00"
relations:
- target: 69415fc4-08c7-497a-b1ef-2f135c6400f2
type: CAUSES
direction: incoming
strength: 0.5
---
**Error**: Player team updates sent wrong parameter name to API, causing dem_week values to be ignored.
**Problem**: Code was sending 'dem_week' as query parameter, but API expects 'demotion_week'.
**Root Cause**: Developer misunderstood API parameter naming during initial implementation. Tests verified internal logic but not the actual API parameter name being sent.
**Impact**:
- v2.29.0 and v2.29.1 sent dem_week parameter which API silently ignored
- All player updates (transaction freeze, IL moves, draft picks) failed to set demotion_week field
- No errors raised - parameter was simply not recognized by API
**Fix**: Changed parameter name in services/player_service.py line 426:
- WRONG: updates['dem_week'] = dem_week
- CORRECT: updates['demotion_week'] = dem_week
**Internal Naming**: Kept Python parameter name as 'dem_week' for code brevity, but map to 'demotion_week' when sending to API.
**Test Updates**: Updated 4 tests to verify correct parameter name is sent to API.
**Prevention Strategies**:
1. Always verify API parameter names against API documentation/OpenAPI spec
2. Test against actual API or accurate mocks with exact parameter names
3. Use API client type hints that match exact API contract
4. Add integration tests that verify HTTP request parameters
5. Check API response for success indicators, not just lack of errors
**Quick Fix Pattern**:
1. Change parameter name in dictionary: 'dem_week' → 'demotion_week'
2. Update all test assertions to check for correct parameter name
3. Run tests to verify: pytest tests/test_services_player_service.py
4. Deploy hotfix immediately
**Deployment Impact**: Required hotfix v2.29.2 to correct v2.29.0/v2.29.1.