StockSharp/StockSharp · error · ValueError

section not found: {title}

Error message

section not found: {title}

What it means

check-readme-connectors.py validates that each localized README (en, ru, zh) contains required connector sections. The section_bounds function searches for a line starting with '## {title}'. If no such heading is found, it raises ValueError with the missing section name. The script checks sections defined in COMMON_SECTIONS (crypto, dex, stock, forex) across all three languages.

Source

Thrown at scripts/check-readme-connectors.py:89

                value = value[: -len(trailer)].strip()
                break

        return [item.strip() for item in value.rstrip(".\u3002").split(",") if item.strip()]

    return None


def section_bounds(lines: list[str], title: str) -> tuple[int, int]:
    heading = f"## {title}"
    start = None

    for index, line in enumerate(lines):
        if line.strip().startswith(heading):
            start = index + 1
            break

    if start is None:
        raise ValueError(f"section not found: {title}")

    end = len(lines)
    for index in range(start, len(lines)):
        if lines[index].startswith("## "):
            end = index
            break

    return start, end


def parse_connector_rows(lines: list[str], title: str) -> list[tuple[str, str | None]]:
    start, end = section_bounds(lines, title)
    rows: list[tuple[str, str | None]] = []

    for line in lines[start:end]:
        if not line.startswith('|<img src="./Media/logos/'):
            continue

View on GitHub (pinned to 601a191de6)

Solutions

  1. Add the missing '## {title}' heading to the README file indicated in the error message.
  2. Ensure all three language READMEs (en, ru, zh) have the same set of section headings with exact text from COMMON_SECTIONS.
  3. Check for exact heading text matches including capitalization and spacing.

Example fix

# before — README.ru.md is missing the section
(no '## Криптобиржи' heading)

# after — add the heading with connector rows
## Криптобиржи
| <img src="./Media/logos/binance.svg" /> | Binance |
Defensive patterns

Strategy: validation

Validate before calling

def ensure_section(readme_path: Path, title: str) -> None:
    lines = readme_path.read_text(encoding="utf-8-sig").splitlines()
    heading = f"## {title}"
    if not any(line.strip().startswith(heading) for line in lines):
        raise ValueError(f"Add heading '{heading}' to {readme_path}")

Try / catch

try:
    start, end = section_bounds(lines, title)
except ValueError:
    print(f"WARNING: section '{title}' not found, skipping")
    return []

Prevention

When it happens

Trigger: Running the README connector check when a required section heading (e.g., '## Crypto exchanges', '## Forex') is missing from one of the README files. The script calls section_bounds for every COMMON_SECTIONS title in every language.

Common situations: Renaming or removing a connector category heading in README.md without updating the ru or zh variants; adding a new COMMON_SECTIONS entry without adding the heading to all three READMEs; formatting changes that break the '## ' prefix.

Related errors


AI-assisted analysis of StockSharp/StockSharp@601a191de6 (2026-08-13). Data as JSON: /api/errors/c40206cd280b957d. Report an issue: GitHub.