{"record":{"id":"10768d1799f1549c","repo":"langflow-ai/langflow","slug":"could-not-locate-the-what-end-marker-needle-r","errorCode":null,"errorMessage":"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.","messagePattern":"Could not locate the (.+?) end marker \\((.+?)\\) in pyproject\\.toml\\.  Re-add the ``langflow-extensions:bundle-\\*`` marker pair before re-running -- see src/bundles/PORTING\\.md\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"scripts/migrate/port_bundle.py","lineNumber":1133,"sourceCode":"    ROOT_PYPROJECT.write_text(text, encoding=\"utf-8\")\n    return actions\n\n\n# ---------------------------------------------------------------------------\n# Phase C: workspace + external consumers\n# ---------------------------------------------------------------------------\n\n\ndef _insert_before_marker(text: str, end_marker: str, payload: str, *, what: str) -> str:\n    needle = end_marker\n    idx = text.find(needle)\n    if idx == -1:\n        msg = (\n            f\"Could not locate the {what} end marker ({needle!r}) in \"\n            \"pyproject.toml.  Re-add the ``langflow-extensions:bundle-*`` \"\n            \"marker pair before re-running -- see src/bundles/PORTING.md.\"\n        )\n        raise SystemExit(msg)\n    line_start = text.rfind(\"\\n\", 0, idx) + 1\n    return text[:line_start] + payload + text[line_start:]\n\n\ndef _patch_root_pyproject(plan: PortPlan, *, apply: bool) -> list[str]:\n    actions = [f\"patch {ROOT_PYPROJECT.relative_to(REPO_ROOT)}\"]\n    if not apply:\n        return actions\n    text = ROOT_PYPROJECT.read_text(encoding=\"utf-8\")\n    bundle = plan.bundle\n\n    if f\"lfx-{bundle}\" in text:\n        msg = f\"lfx-{bundle} already referenced in {ROOT_PYPROJECT.relative_to(REPO_ROOT)}; not patching.\"\n        raise SystemExit(msg)\n\n    dep_line = f'    \"lfx-{bundle}>=0.1.0\",\\n'\n    source_line = f\"lfx-{bundle} = {{ workspace = true }}\\n\"\n    member_line = f'    \"src/bundles/{bundle}\",\\n'","sourceCodeStart":1115,"sourceCodeEnd":1151,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/scripts/migrate/port_bundle.py#L1115-L1151","documentation":"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.","triggerScenarios":"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.","commonSituations":"Comment-stripping formatters or linters; someone reorganizing the workspace/deps sections and dropping 'unused' comments; merge conflicts resolved without preserving markers.","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."],"exampleFix":"# before (pyproject.toml)\n# marker comment deleted by cleanup PR\n\n# after (pyproject.toml)\n# langflow-extensions:bundle-start\n...\n# langflow-extensions:bundle-end","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nNEEDLES = (\"langflow-extensions:bundle\",)  # match the exact markers from PORTING.md\n\ndef markers_present(pyproject: Path) -> bool:\n    text = pyproject.read_text(encoding=\"utf-8\")\n    return all(needle in text for needle in NEEDLES)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["migration","pyproject","markers","formatting","cli"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}