langflow-ai/langflow · error · SystemExit
Could not locate the {what} end marker ({needle!r}) in pypro
Error message
Could not locate the {what} end marker ({needle!r}) in pyproject.toml. Re-add the ``langflow-extensions:bundle-*`` marker pair before re-running -- see src/bundles/PORTING.md. What it means
port_bundle.py edits the root pyproject.toml by inserting generated blocks (workspace member, dependency entries, etc.) immediately before a sentinel 'end marker' comment — the langflow-extensions:bundle-* marker pair. _insert_before_marker does a plain text.find() for the needle; if the marker comment was deleted or reworded, find returns -1 and the script exits with this error, instructing you to restore the marker pair (documented in src/bundles/PORTING.md) before re-running.
Source
Thrown at scripts/migrate/port_bundle.py:1133
ROOT_PYPROJECT.write_text(text, encoding="utf-8")
return actions
# ---------------------------------------------------------------------------
# Phase C: workspace + external consumers
# ---------------------------------------------------------------------------
def _insert_before_marker(text: str, end_marker: str, payload: str, *, what: str) -> str:
needle = end_marker
idx = text.find(needle)
if idx == -1:
msg = (
f"Could not locate the {what} end marker ({needle!r}) in "
"pyproject.toml. Re-add the ``langflow-extensions:bundle-*`` "
"marker pair before re-running -- see src/bundles/PORTING.md."
)
raise SystemExit(msg)
line_start = text.rfind("\n", 0, idx) + 1
return text[:line_start] + payload + text[line_start:]
def _patch_root_pyproject(plan: PortPlan, *, apply: bool) -> list[str]:
actions = [f"patch {ROOT_PYPROJECT.relative_to(REPO_ROOT)}"]
if not apply:
return actions
text = ROOT_PYPROJECT.read_text(encoding="utf-8")
bundle = plan.bundle
if f"lfx-{bundle}" in text:
msg = f"lfx-{bundle} already referenced in {ROOT_PYPROJECT.relative_to(REPO_ROOT)}; not patching."
raise SystemExit(msg)
dep_line = f' "lfx-{bundle}>=0.1.0",\n'
source_line = f"lfx-{bundle} = {{ workspace = true }}\n"
member_line = f' "src/bundles/{bundle}",\n'View on GitHub (pinned to 976ec789d2)
Solutions
- Restore the marker pair in pyproject.toml exactly as documented in src/bundles/PORTING.md (grep another bundle's markers for the exact wording: `grep -n 'langflow-extensions:bundle' pyproject.toml`).
- Re-run `python scripts/migrate/port_bundle.py --bundle <name> --apply`; insertion is idempotent with respect to the markers.
- Add the marker comments to any protected-comment list in your formatter config so they survive future cleanups.
Example fix
# before (pyproject.toml) # marker comment deleted by cleanup PR # after (pyproject.toml) # langflow-extensions:bundle-start ... # langflow-extensions:bundle-end
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
NEEDLES = ("langflow-extensions:bundle",) # match the exact markers from PORTING.md
def markers_present(pyproject: Path) -> bool:
text = pyproject.read_text(encoding="utf-8")
return all(needle in text for needle in NEEDLES) Prevention
- Treat the langflow-extensions:bundle-* comments in pyproject.toml as load-bearing sentinels — never delete or reword them.
- Configure formatters/linters to preserve these comments (or exempt pyproject.toml from comment stripping).
- After resolving merge conflicts in pyproject.toml, grep for the marker pair before re-running port_bundle.py.
When it happens
Trigger: Running port_bundle.py --apply when the `# langflow-extensions:bundle-...-end` (or corresponding) marker comment has been removed from pyproject.toml — by a cleanup PR, an aggressive formatter, or a manual edit that assumed the comment was decorative.
Common situations: Comment-stripping formatters or linters; someone reorganizing the workspace/deps sections and dropping 'unused' comments; merge conflicts resolved without preserving markers.
Related errors
- Could not strip ruff per-file-ignore entry for {ri.pattern!r
- lfx-{bundle} already referenced in {ROOT_PYPROJECT.relative_
- provider directory not found: {src}
- destination already exists (already consolidated?): {dst}
- {provider}: source has subdirectory/ies {subdirs} that move_
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/10768d1799f1549c.
Report an issue: GitHub.