[Bug] SEC 13F-HR: empty filings (zero holdings) crash with ValidationError on weight
Describe the bug
obb.equity.ownership.form_13f (provider sec) raises a pydantic ValidationError for any 13F-HR filing with no reportable holdings. Managers that have exited all positions still must file, and EDGAR requires the information table to contain at least one row, so these filings carry a single placeholder entry (nameOfIssuer=NA, cusip=000000000, value=0).
ValidationError: 1 validation error for SecForm13FHRData
weight
Input should be a valid number [type=float_type, input_value=None, input_type=NoneType]
Root cause
openbb_sec/utils/parse_13f.py (parse_13f_hr, ~L223):
total_value = df.value.sum()
df["weight"] = round(df.value.astype(float) / total_value, 6)
For an empty filing total_value == 0, so the division yields 0/0 = NaN. The subsequent .replace({nan: None, "--": None}) turns it into None, and SecForm13FHRData declares weight: float (not Optional) in openbb_sec/models/form_13FHR.py (~L31), so validation fails and the whole fetch dies.
How to reproduce
Thiel Macro LLC (CIK 1562087) has filed empty 13F-HRs since Q4 2025:
from openbb import obb
obb.equity.ownership.form_13f(symbol="1562087", date="2026-03-31", provider="sec")
# ValidationError: weight — Input should be a valid number
Suggested fix (one line)
df["weight"] = (
round(df.value.astype(float) / total_value, 6) if total_value else 0.0
)
Verified locally against openbb-sec 1.6.6/1.6.7 (the affected lines are identical in main): the empty filing then returns its placeholder row with weight=0.0, and normal filings are unchanged (sum(weight) == 1.0 exactly on a 70-position filing).
Happy to open a PR with this change (together with a fix for a separate entity-mangling issue in the same parser — see companion issue).
[Bug] SEC 13F-HR: empty filings (zero holdings) crash with ValidationError on
weightDescribe the bug
obb.equity.ownership.form_13f(providersec) raises a pydanticValidationErrorfor any 13F-HR filing with no reportable holdings. Managers that have exited all positions still must file, and EDGAR requires the information table to contain at least one row, so these filings carry a single placeholder entry (nameOfIssuer=NA,cusip=000000000,value=0).Root cause
openbb_sec/utils/parse_13f.py(parse_13f_hr, ~L223):For an empty filing
total_value == 0, so the division yields0/0 = NaN. The subsequent.replace({nan: None, "--": None})turns it intoNone, andSecForm13FHRDatadeclaresweight: float(not Optional) inopenbb_sec/models/form_13FHR.py(~L31), so validation fails and the whole fetch dies.How to reproduce
Thiel Macro LLC (CIK
1562087) has filed empty 13F-HRs since Q4 2025:Suggested fix (one line)
Verified locally against openbb-sec 1.6.6/1.6.7 (the affected lines are identical in
main): the empty filing then returns its placeholder row withweight=0.0, and normal filings are unchanged (sum(weight) == 1.0exactly on a 70-position filing).Happy to open a PR with this change (together with a fix for a separate entity-mangling issue in the same parser — see companion issue).