HKUDS/Vibe-Trading · error · RuntimeError
SEC fails-to-deliver index listed no archives
Error message
SEC fails-to-deliver index listed no archives
What it means
_ftd_urls scrapes the SEC fails-to-deliver FOIA index page and regex-extracts links to cnsfails*.zip archives. If the regex finds nothing — empty index, moved page, or HTML schema change — this RuntimeError fires before any download. A pinned URL bypasses the scrape entirely.
Source
Thrown at agent/src/tools/institutional_holdings_tool.py:448
(``/files/data/fails-deliver-data/`` and ``/files/data/other/fails-deliver-data/``)
and only the page knows which is which.
Returns:
Newest-first absolute ``.zip`` URLs, at most the configured file count.
Raises:
requests.RequestException: If the landing page cannot be fetched.
RuntimeError: If the page lists no archives.
"""
data_config = get_env_config().data
pinned = data_config.vibe_trading_sec_ftd_url.strip()
if pinned:
return [pinned]
wanted = max(1, min(data_config.vibe_trading_sec_ftd_files, _MAX_FTD_FILES))
html = _sec_get(_FTD_INDEX_URL).text
hrefs = re.findall(r'href="(/[^"]*cnsfails\d{6}[ab]\.zip)"', html)
if not hrefs:
raise RuntimeError("SEC fails-to-deliver index listed no archives")
ordered = sorted(dict.fromkeys(hrefs), key=lambda h: h.rsplit("/", 1)[-1], reverse=True)
return [f"https://www.sec.gov{h}" for h in ordered[:wanted]]
def _load_ftd_map(url: str, into: Dict[str, Tuple[str, str]]) -> None:
"""Merge one fails-to-deliver archive into ``into`` as ticker -> (cusip, description).
The pipe-delimited payload is ``SETTLEMENT DATE|CUSIP|SYMBOL|QUANTITY
(FAILS)|DESCRIPTION|PRICE``. Earlier entries win, so a newer archive passed
first keeps precedence over an older one.
Args:
url: Absolute URL of a ``cnsfailsYYYYMM{a,b}.zip`` archive.
into: Accumulator mutated in place.
Raises:
requests.RequestException: On transport failure.
zipfile.BadZipFile: If the payload is not a zip archive.View on GitHub (pinned to 80ffdda44c)
Solutions
- Configure the pinned FTD URL setting (vibe_trading config data_config) so the index is not scraped
- Retry later — transient SEC issues are common
- Update the href regex in _ftd_urls if the archive naming changed
Defensive patterns
Strategy: fallback
Try / catch
try:
urls = _ftd_urls()
except RuntimeError:
urls = [PINNED_FTD_URL] # configured fallback archive Prevention
- Configure the pinned FTD URL so the index scrape is skipped
- Cache the discovered archive list
- Add a canary test against the index page to catch schema drift early
When it happens
Trigger: SEC restructures the FTD index page so hrefs no longer match the pattern; index temporarily empty; request returned an error/HTML block page. Called via _cusip_map.
Common situations: SEC site redesigns, bot-blocking returning an empty body, or network proxies stripping content.
Related errors
- Feishu QR login requires a JSON agent config; use ~/.vibe-tr
- agent config 'channels' must be an object
- agent config 'channels.feishu' must be an object
- group_message_buffer_size must be > 0
- SSE connection failed with status {response.status_code}
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/7a3c0bdb79d09d3d.
Report an issue: GitHub.