-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
When I use Research Agent and the fetch_periodic_sec_filings tool is called, sometimes I meet error "Cannot locate timezone 'UTC'" when either year or quarter parameter is set.
Screenshots
To Reproduce
Note: set AGENT_DEBUG_MODE=true to trace model behavior locally.
Run the following in [project directory]\python:
from valuecell.agents.research_agent.sources import fetch_periodic_sec_filings
# Successful path (only limit)
await fetch_periodic_sec_filings(
cik_or_ticker="AAPL",
forms=["10-Q"],
limit=3,
)
# Failing path (with year / quarter)
await fetch_periodic_sec_filings(
cik_or_ticker="AAPL",
forms=["10-Q"],
year=[2025, 2026],
quarter=[1, 3, 4],
limit=3,
)
Expected behavior
On Windows, when year/quarter is provided:
- Either return filtered SEC filings normally; or
- When tzdata is missing, provide a clearer error message (suggesting to install tzdata or run PyArrow's tzdata installation tool), rather than directly throwing a low-level ArrowInvalid.
Actual behavior
- Without year/quarter: returns a normal SECFilingResult.
- With year/quarter: throws an error (excerpt):
pyarrow.lib.ArrowInvalid: Cannot locate timezone 'UTC': Timezone database not found at "C:\Users\lyt\Downloads\tzdata"
Environment
OS: Windows 11
Python: 3.12.12 (via uv)
Browser: Edge
Using the newest version in main branch [commit 9793e9c]
Project is locally deployed
Preliminary root cause analysis
The year/quarter branch of fetch_periodic_sec_filings calls edgar's filter_by_year_quarter, which under the hood uses PyArrow to filter a timezone-aware time column. On Windows, the current PyArrow version by default looks for the timezone database at %USERPROFILE%\Downloads\tzdata (e.g., C:\Users\xxx\Downloads\tzdata). If this directory does not exist or is incomplete, the above error occurs. The project code does not explicitly configure this path; this is PyArrow's default behavior on Windows.
Related Q&A on stackoverflow: https://stackoverflow.com/questions/74267313/how-to-use-tzdata-file-with-pyarrow-compute-assume-timezone/74292266#74292266