edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

10-K Item 3 overflows past its end boundary: Workiva TOC rows with split label/title hrefs mis-anchor or drop items (Tesla)

Open sf1tzp opened this issue 4 months ago • 1 comments

Issue Type

  • [x] Data Quality Issue (incorrect financial values, missing data)
  • [ ] XBRL Parsing Issue (statement rendering, concept mapping)
  • [ ] Filing Access Issue (download failures, attachment problems)
  • [ ] Performance Issue (slow operations, memory problems)
  • [ ] Compatibility Issue (platform/dependency conflicts)
  • [ ] Documentation Issue (unclear instructions, missing examples)

Environment

EdgarTools Version: 5.43.1 Python Version: 3.13.2 Operating System: Ubuntu 24.04 LTS (kernel 6.8.0-136-generic)

Bug Description

What you expected to happen:

part_i_item_3's end boundary should stop at the next item's line-anchored header, which is present in the document body (ITEM 4. MINE SAFETY DISCLOSURES, and ITEM 6. [RESERVED] at offset 3,946 of the returned slice). When the TOC parse fails to anchor an item (here Part I Item 4), body-header recovery should bound the previous section instead of letting it run to the next detected anchor — and the item lookup should not return an over-captured slice with no signal.

What actually happened:

For Tesla, Inc.'s FY2023 10-K, obj['Item 3'] returns 145,561 chars — the actual legal-proceedings body (~1.2K chars of rendered text) plus everything through the end of Part II Item 5. The section map is missing part_i_item_1b, part_i_item_4, and part_ii_item_5, and anchors Items 1 and 1A at the wrong positions (with a knock-on shift that truncates Item 8 to 2.5K chars), so Item 3's end boundary overshoots to the next detected anchor.

Unlike older versions, the section map does flag this (part_i_item_3 at confidence 0.5 with an explicit over-capture warning) — but the obj[...] item lookup surfaces none of that, so consumers using the item API get the over-captured slice with no signal on the returned value.

Error message (if any):

None — the item lookup is silent; the only signal is Section.warnings on the
section map (part_i_item_3 confidence 0.5, over-capture warning; part_ii_item_8
confidence 0.5, truncation warning).

Reproduction

Company/Ticker: Tesla, Inc. (TSLA), CIK 0001318605 Time Period: FY2023 (period 2023-12-31, filed 2024-01-29) Relevant Forms: 10-K, accession 0001628280-24-002390

Minimal code to reproduce:

import os
import re

os.environ.setdefault("EDGAR_IDENTITY", "you [email protected]")
from edgar import find

f = find("0001628280-24-002390")
obj = f.obj()
print("full text:", len(f.text()))

content = obj['Item 3'] or ""
print("Item 3:", len(content), "chars")
print("tail:", repr(content[-200:]))

# Line-anchored headers of items that should FOLLOW this section. Any hit
# means the extraction overran its end boundary. \s+ between "Item" and the
# number: filer templates often use a non-breaking space ("Item\xa01A.").
for item in ['Item 4', 'Item 5', 'Item 6', 'Item 7', 'Item 7A', 'Item 8']:
    pat = re.escape(item).replace("\\ ", "\\s+")
    m = re.search(rf"(?m)^\s*{pat}\s*[.:–—-]", content)
    print(item, "->", m.start() if m else None)

# Section map: name, chars, confidence, detection method, warnings
for name, s in obj.document.sections.items():
    txt = s.text() or ""
    print(name, len(txt), getattr(s, "confidence", None),
          getattr(s, "detection_method", None), getattr(s, "warnings", None))

Observed:

full text: 500,695

obj['Item 3']: 145,561 chars
  embedded successor header @ 3,946: 'ITEM 6. [RESERVED]'
  tail: '...net carrying value of our intangible assets decreased from $215 million
         as of December 31, 2022 to $178 million as of December 31, 2023 mainly
         from amortization.'                     (Part II Item 5 content)

section map (name: chars, confidence, method, warnings):
  part_i_item_1:     10,251  0.95  toc  []       <- wrong anchor (label href)
  part_i_item_1c:     5,744  0.95  toc  []
  part_i_item_2:      1,138  0.95  toc  []
  part_i_item_3:    145,561  0.5   toc  ['Item 3 content contains the header of
                                          Item 4, which was not detected as its own
                                          section — the end boundary likely overshoots
                                          into later items (extraction over-captured).']
  part_ii_item_6:     4,820  0.95  toc  []
  part_ii_item_7:    59,421  0.95  toc  []
  part_ii_item_7a:    3,938  0.95  toc  []
  part_ii_item_8:     2,496  0.5   toc  ['Item 8 content is 2,500 chars, below the
                                          expected minimum of 26,136 for a 10-K ...
                                          (extraction likely truncated).']
  part_ii_item_9 ... part_iv_signatures: normal
  (part_i_item_1b, part_i_item_4, part_ii_item_5 are MISSING entirely)

Additional Context

Root cause (traced in _analyze_workiva_toc)

Tesla's Workiva TOC splits each row into a label link ("Item 4.") and a title link ("Mine Safety Disclosures") with different hrefs, and the label hrefs are broken or wrong. The parser (edgar/documents/utils/toc_analyzer.py) groups a row's links by href and takes the first group that parses to an item — the label group:

  • When the label's target exists but is wrong, the item maps there: Item 1's label points at ..._67 — a bare page-break <div> (and the target the generic parser assigns to Item 8) — so part_i_item_1 lands in the wrong place; same for Item 1A (..._73). The knock-on boundary shift also truncates Item 8.
  • When the label's target doesn't exist (..._205, _208, _211, _214, _217), the group is rejected and the row survives only if the title text is in the keyword vocabulary: "Properties" and "Legal Proceedings" are → Items 2/3 get correct (title-link) anchors; "Unresolved Staff Comments", "Mine Safety Disclosures", and Item 5's long title are not → Items 1B, 4, and Part II Item 5 are silently dropped.

The generic TOC parser resolves all 24 entries with correct (title-link) anchors on this same filing; only the Workiva-agent path mis-anchors and drops items:

from edgar.documents.utils.toc_analyzer import TOCAnalyzer
a = TOCAnalyzer(form='10-K')
a.analyze_toc_structure(html)                    # 24 correct entries
a.analyze_toc_structure(html, agent='Workiva')   # 21 entries; part_i_item_1 -> ..._67
                                                 # (wrong); Items 1B/4/5 absent

A fix can prefer the href group whose target exists and whose neighborhood matches the item heading (in Workiva filings that is the title/page-number link), and recover label-less rows from the row text's item number plus the title link's target instead of requiring a vocabulary hit.

Impact

Downstream consumers get the section plus everything after it through Part II Item 5, which silently duplicates content across sections and inflates token counts for NLP/RAG pipelines. The section map carries a warning here, but the obj[...] item lookup surfaces none of it.

  • Tesla files this same template every year; its 10-Qs 2024–2026 show an analogous defect (Part I, Item 4 — Controls and Procedures — resolves to financial-statement note content instead of the item body).
  • A bulk scan of Fortune-500 filings (edgartools 5.43.1) surfaced the same overflow shape — a successor item's line-anchored header embedded inside the returned section — on ES, ET, GOLD, HTZ, LPLA, ONDS, POST, PPL, SMR, TAP, VRT 10-Ks and QCOM/WM 10-K Item 1, ED 10-K Item 7. Note some of these filers write headers with a non-breaking space ("Item\xa01A. Risk Factors"), which whitespace-strict boundary probes miss.

Related prior art

  • #904 (fixed in #906, 5.43.1) — same downstream shape (a missing successor anchor lets the previous section's end boundary overshoot), but there the anchors went missing in the TOC-subset/body-header-recovery path; here they go missing in the Workiva-agent TOC parser (split label/title links, broken label hrefs). The #906 union-merge recovery doesn't fire here because the dropped items (1B, 4, 5) aren't in its core-item list.
  • #837 (fixed 5.29.x) — Workiva split label/title cells; fixed by adding the keyword-vocabulary fallback, which is exactly the path that leaves "Mine Safety Disclosures" et al. behind here.

PR #916 implements the fix (row-wise anchor selection with heading verification in _analyze_workiva_toc) with regression tests against this filing.


This issue will be handled using EdgarTools' systematic issue resolution workflow. A reproduction test will be created to verify the fix.

sf1tzp avatar Jul 29 '26 05:07 sf1tzp

Released in 5.44.0, now on PyPI.

Verified before merge on your reported filing: obj['Item 3'] returns 1,165 chars (was 145,561), Items 1B / 4 / Part II Item 5 are back in the section map, and Item 8 recovered from 2.5K to 161K chars. A section-map diff across all 54 committed 10-K/10-Q fixtures showed 0 sections lost and 5 gained, so the change is strictly additive.

Thanks again — both the diagnosis and the fix were yours.

dgunning avatar Jul 29 '26 23:07 dgunning