ruvnet/RuView · warning · HTTPException
Query range cannot exceed 7 days
Error message
Query range cannot exceed 7 days
What it means
HTTP 400 from POST /pose/historical when end_time - start_time exceeds 7 days (max_range = timedelta(days=7)). The cap limits how much data a single query can aggregate. Combined with the ordering check, any accepted range is a positive span of at most 7 days.
Source
Thrown at archive/v1/src/api/routers/pose.py:257
@router.post("/historical")
async def get_historical_data(
request: HistoricalDataRequest,
pose_service: PoseService = Depends(get_pose_service),
current_user: Dict = Depends(require_auth)
):
"""Get historical pose estimation data."""
try:
# Validate time range
if request.end_time <= request.start_time:
raise HTTPException(
status_code=400,
detail="End time must be after start time"
)
# Limit query range to prevent excessive data
max_range = timedelta(days=7)
if request.end_time - request.start_time > max_range:
raise HTTPException(
status_code=400,
detail="Query range cannot exceed 7 days"
)
data = await pose_service.get_historical_data(
start_time=request.start_time,
end_time=request.end_time,
zone_ids=request.zone_ids,
aggregation_interval=request.aggregation_interval,
include_raw_data=request.include_raw_data
)
return {
"query": {
"start_time": request.start_time,
"end_time": request.end_time,
"zone_ids": request.zone_ids,
"aggregation_interval": request.aggregation_intervalView on GitHub (pinned to 4685618388)
Solutions
- Split the request into consecutive windows of at most 7 days and aggregate client-side (see exampleFix)
- Keep default visible windows to 7 days or less
- If you operate the server and genuinely need longer ranges, raise max_range knowing larger queries cost more
Example fix
# before
windows = [(now - timedelta(days=30), now)]
# after
windows = []
cur = now - timedelta(days=30)
while cur < now:
windows.append((cur, min(cur + timedelta(days=7), now)))
cur += timedelta(days=7) Defensive patterns
Strategy: validation
Validate before calling
from datetime import timedelta
def chunk_range(start, end, max_days=7):
windows = []
cur = start
while cur < end:
nxt = min(cur + timedelta(days=max_days), end)
windows.append((cur, nxt))
cur = nxt
return windows Try / catch
resp = await client.post('/pose/historical', json=body)
if resp.status_code == 400 and 'cannot exceed' in resp.json().get('detail', ''):
results = [await fetch_window(s, e) for s, e in chunk_range(start, end)]
else:
resp.raise_for_status() Prevention
- Cap default dashboard windows at 7 days
- Chunk exports client-side instead of requesting full history
- Encode the 7-day limit as a client constant next to the range picker
When it happens
Trigger: POST /pose/historical requesting a 30-day window (end - start > 7 days), e.g. a monthly dashboard default or a full-history export attempt.
Common situations: Dashboards defaulting to 30/90-day windows; export scripts trying to pull all history in one call.
Related errors
- End time must be after start time
- Page must be >= 1
- Size must be >= 1
- Size must be <= {max_size}
- min_confidence must be between 0.0 and 1.0
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/e9ade24e6e397100.
Report an issue: GitHub.