BDC: `PortfolioInvestments.from_statement` parses identifiers without member candidates, so it names 381 of 1,654 positions differently from `from_xbrl`
Issue Type
- [x] Data Quality Issue (incorrect financial values, missing data)
Environment
EdgarTools Version: 5.62.0, and main at b75507c9 (the call is unchanged there)
Python Version: 3.14.3
Operating System: Windows 11
Bug Description
Follow-up from #1596, under #1593. (Edited 2026-10-18 after an independent re-check; the first comment lists what changed.)
What you expected to happen:
PortfolioInvestments.from_statement names each position the way PortfolioInvestments.from_xbrl does for the same identifier, as the non-accrual roster now does.
What actually happened:
from_statement (edgar/bdc/investments.py:2926 on main, line 2910 in 5.62.0) calls _parse_investment_identifier(dim_label) with no member candidates. from_xbrl passes _get_investment_member_candidates(xbrl). Over six BDC 10-Qs for 2026-06-30, both called with default arguments on the same filing, and both chose 2026-06-30:
| Filer | Accession | from_xbrl rows |
from_statement rows |
Paired | company_name differs |
|---|---|---|---|---|---|
| KBDC | 0001193125-26-342385 | 335 | 335 | 335 | 314 |
| MSDL | 0001193125-26-337915 | 755 | 756 | 754 | 51 |
| BCSF | 0001193125-26-342491 | 567 | 783 | 565 | 16 |
| CCAP | 0001193125-26-342351 | 646 | 0 | 0 | |
| HTGC | 0001280784-26-000042 | 364 | 0 | 0 | |
| TSLX | 0001193125-26-332725 | 213 | 0 | 0 |
That is 381 of 1,654 paired positions, across the three filings that return rows. Rows are paired by identifier, with : read as _: the statement path's labels carry FIRE_ Finance where from_xbrl carries FIRE: Finance. Pairing KBDC by fair value and cost instead gives the same identifiers.
Examples, from_xbrl first:
- KBDC: "WCHG Buyer, Inc. (Handgards)" / "- Containers & packaging - WCHG Buyer, Inc. (Handgards)"
- MSDL: "World Insurance Associates, LLC" / "Services World Insurance Associates, LLC"
- BCSF: "Bain Capital Senior Loan Program, LLC" / "Investment Vehicles Bain Capital Senior Loan Program, LLC"
from_xbrl is not always right either. Of the 381 differing pairs, its name is the company in 305. In 62 (KBDC 58, BCSF 4) it is the tranche label alone, for example "First lien senior secured", where from_statement's current name contains the company. In 13 on KBDC it keeps a trailing " - First lien senior secured", and in 1 on BCSF it is an industry label ("Services: Business").
CCAP returns no rows at all. With include_untyped=True it returns 647 rows, every one typed Unknown, so the default drops them all. Parsed on their own, 1,120 of CCAP's 1,183 identifier labels type Unknown without candidates, and none do with the filing's 454.
HTGC and TSLX return no rows because the statement lookup picks the wrong role. xbrl.statements.schedule_of_investments() returns the forward-FX role on HTGC and the interest-rate-swaps role on TSLX, and those carry no InvestmentIdentifierAxis labels. Their main schedule roles do: 3,846 of 4,159 rows on HTGC, 3,478 of 3,778 on TSLX. Passed the main role, from_statement names 211 of 364 HTGC positions and 92 of 213 TSLX positions differently from from_xbrl, and 0 once given the filing's candidates. I can open the role lookup separately if you want it tracked.
Who reaches it. The only internal caller is BDC.portfolio_investments() (edgar/bdc/reference.py:272), which falls back to from_statement only when from_xbrl returns no rows. No guide documents from_statement. On 38 of 38 BDC 10-K and 10-Q filings I checked, from_xbrl returned rows, so the fallback was not reached.
Reproduction
from edgar import find
from edgar.bdc.investments import PortfolioInvestments
x = find("0001193125-26-342385").xbrl() # KBDC 10-Q, 2026-06-30
a = {i.identifier.replace(":", "_"): i.company_name for i in PortfolioInvestments.from_xbrl(x)}
b = {i.identifier.replace(":", "_"): i.company_name
for i in PortfolioInvestments.from_statement(x.statements.schedule_of_investments())}
print(sum(a[k] != b[k] for k in a.keys() & b.keys()), "of", len(a.keys() & b.keys())) # 314 of 335
What passing the candidates would do, measured with a local patch
Passing _get_investment_member_candidates(statement.xbrl) to _parse_investment_identifier, as #1596 did for the roster:
| Filer | Names differing from from_xbrl |
Rows | Fair-value sum |
|---|---|---|---|
| KBDC | 314 to 3 | 335 to 335 | unchanged |
| MSDL | 51 to 0 | 756 to 757 | $3,911.5M to $4,014.0M |
| BCSF | 16 to 1 | 783 to 783 | unchanged |
| CCAP | (no rows before) | 0 to 647 | $1,570.7M, within $2,000 of from_xbrl's (647 rows against 646) |
The 4 remaining differences are : read as _ inside a name: KBDC's "Guided Practice Solutions_ Dental, LLC (GPS)" (3 rows) and BCSF's "Services_ Business" (1 row).
I would not take that patch as it stands:
- It copies
from_xbrl's bad names. In the 62 pairs above wherefrom_xbrlkeeps only the tranche label,from_statementwould lose the company it names today. - MSDL: it retypes one
Unknownrow, Capstone Lending, LLC (JV equity, $102.5M), as equity. The statement also has a separate "Capstone Lending LLC" row of $102.5M, so the position counts twice.from_xbrlhas it once. - BCSF, a larger gap the patch does not touch:
from_statementkeeps 202 rows that are the joint ventures' own holdings ($2,293.5M), whichfrom_xbrlfilters with_NON_HOLDING_AXES. Another 16 rows have nofrom_xbrlpair ($0.05M). Together they are the whole gap: $4,657.5M againstfrom_xbrl's $2,363.9M.
So candidates alone don't make from_statement agree with from_xbrl. Having it hand off to the from_xbrl path may be simpler. Given how rarely it is reached, it's your call whether it is worth doing.
Generated by Claude Code
Correction: I had this issue re-checked independently after filing it, and parts of the original were wrong. The body and title are now fixed:
- The total is 381 of 1,654 paired positions, not 1,653.
- HTGC's and TSLX's main schedule roles do carry
InvestmentIdentifierAxislabels. The cause is only the lookup:schedule_of_investments()returns the forward-FX role on HTGC and the interest-rate-swaps role on TSLX. - The fix I proposed is not one to take as written. It would copy
from_xbrl's tranche-only names onto 62 positions wherefrom_statementnames the company today, and on MSDL it counts Capstone Lending ($102.5M) twice. - The Python version is 3.14.3, not 3.12.13.
I also added what the original left out. from_xbrl isn't always right either: of the 381 differing pairs, its name is the company in 305, a tranche label alone in 62, and has a trailing tranche or an industry label in 14. BCSF's from_statement book also keeps 202 joint-venture holdings ($2,293.5M) that from_xbrl filters. The only internal caller is the fallback in BDC.portfolio_investments(), which none of the 38 BDC filings I checked reached.
Sorry for the noise.