OpenBB-finance/OpenBB · error · OpenBBError
Unsupported document format. File must be PDF or HTM type ->
Error message
Unsupported document format. File must be PDF or HTM type -> {url} What it means
Raised by the same router one check later: the URL passed the origin whitelist but its lowercase extension is neither .pdf, .htm, nor .html. The handler only knows how to extract/encode those document types, so anything else (e.g. .docx, .csv, extensionless) is rejected before the request is made.
Source
Thrown at openbb_platform/providers/federal_reserve/openbb_federal_reserve/router.py:73
hostname = parsed_url.hostname or ""
if parsed_url.scheme != "https" or hostname not in {
"www.federalreserve.gov",
"federalreserve.gov",
}:
raise OpenBBError(
"Invalid URL provided for download. Must be from federalreserve.gov -> "
+ url
)
is_pdf = url.lower().endswith(".pdf")
if (
not is_pdf
and not url.lower().endswith(".htm")
and not url.lower().endswith(".html")
):
raise OpenBBError(
"Unsupported document format. File must be PDF or HTM type -> " + url
)
try:
response = make_request(url)
response.raise_for_status()
pdf = (
base64.b64encode(BytesIO(response.content).getvalue()).decode("utf-8")
if isinstance(response.content, bytes)
else response.content
)
results.append(
{
"content": pdf,
"data_format": {
"data_type": "pdf" if is_pdf else "markdown",
"filename": url.split("/")[-1],
},View on GitHub (pinned to 3e071fcc2c)
Solutions
- Link directly to the .pdf or .htm/.html version of the document (most Fed pubs have a /pubs/ PDF path).
- Strip query strings/fragments so the URL ends with the recognized extension.
- For other file types, fetch them with your own HTTP client instead of this router.
Example fix
// before obb.federal_reserve.download(url=['https://www.federalreserve.gov/data/file.csv']) // after obb.federal_reserve.download(url=['https://www.federalreserve.gov/publications/files/report.pdf'])
Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlparse
path = urlparse(url).path.lower()
assert path.endswith(('.pdf', '.htm', '.html')), url Type guard
def is_supported_doc(url: str) -> bool:
from urllib.parse import urlparse
return urlparse(url).path.lower().endswith(('.pdf', '.htm', '.html')) Prevention
- Link to the .pdf/.htm rendition of Fed documents
- Drop query strings so extension checks see the true suffix
When it happens
Trigger: Passing a federalreserve.gov URL ending in .docx/.xls/.csv/.json or with no extension (many Fed publication links use query strings or extensionless paths); a URL with trailing punctuation or query params after a non-whitelisted extension.
Common situations: Copying links to Fed data files or press-release pages with unusual extensions; concatenating query parameters so the extension check no longer matches the end of the string.
Related errors
- At least one extension type must be selected.
- Incorrect email or password
- Charting is not installed. Please install `openbb-charting`.
- Invalid command : route={route}
- OBBject Extension Error -> An OBBject extension that modif
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/ba63327adc34a237.
Report an issue: GitHub.