langflow-ai/langflow · warning · SystemExit
lfx-{bundle} already referenced in {ROOT_PYPROJECT.relative_
Error message
lfx-{bundle} already referenced in {ROOT_PYPROJECT.relative_to(REPO_ROOT)}; not patching. What it means
The bundle-migration helper scripts/migrate/port_bundle.py refuses to patch the root pyproject.toml when the string 'lfx-{bundle}' is already present anywhere in that file. This is a guard against double-applying dependency/source/workspace-member entries. It exits via SystemExit, aborting the port before any partial writes.
Source
Thrown at scripts/migrate/port_bundle.py:1147
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'
new_text = _insert_before_marker(text, "# langflow-extensions:bundle-deps-end", dep_line, what="bundle-deps")
new_text = _insert_before_marker(
new_text, "# langflow-extensions:bundle-sources-end", source_line, what="bundle-sources"
)
new_text = _insert_before_marker(
new_text, "# langflow-extensions:bundle-members-end", member_line, what="bundle-members"
)
ROOT_PYPROJECT.write_text(new_text, encoding="utf-8")
return actions
def _rewrite_consumers(plan: PortPlan, *, apply: bool) -> list[str]:
if not plan.consumer_rewrites:View on GitHub (pinned to 976ec789d2)
Solutions
- Check whether the bundle was already ported: search root pyproject.toml for 'lfx-<bundle>' in the bundle-deps, bundle-sources and bundle-members marker blocks — if all three entries exist, the port is done and you can skip patching.
- If the reference is a stale leftover from an aborted run, remove the lfx-<bundle> lines from the three marker blocks and re-run the script.
- Run without --apply first to preview planned actions and confirm which steps remain.
Example fix
# before: re-running port_bundle.py --apply for an already-ported bundle # after: verify entries then skip # grep 'lfx-mistral' pyproject.toml -> present in deps/sources/members? port complete; no action needed
Defensive patterns
Strategy: validation
Validate before calling
import re, sys
from pathlib import Path
bundle = "mistral"
text = Path("pyproject.toml").read_text()
if f"lfx-{bundle}" in text:
deps = f' "lfx-{bundle}>=0.1.0",' in text
srcs = f"lfx-{bundle} = {{ workspace = true }}" in text
members = f' "src/bundles/{bundle}",' in text
print(f"already referenced: deps={deps} sources={srcs} members={members}")
sys.exit(0) # treat as done, skip the patch step Prevention
- Run port_bundle.py without --apply first to preview which steps remain.
- Track ported bundles in the migration plan/commit history so re-runs are detectable.
- Keep the marker blocks (# langflow-extensions:*) as the single insertion point for bundle entries.
When it happens
Trigger: Running port_bundle.py --apply (or any path that sets apply=True) twice for the same bundle; or porting a bundle whose name already appears in the root pyproject.toml from a previous migration or manual edit.
Common situations: Re-running a partially completed migration; a teammate already ported the bundle; a manual pyproject.toml edit referenced the bundle earlier and the marker-based insertion would now duplicate it.
Related errors
- destination already exists (already consolidated?): {dst}
- Bundle directory already exists: {bundle_dir}. Refusing to
- Could not locate the {what} end marker ({needle!r}) in pypro
- provider directory not found: {src}
- {provider}: source has subdirectory/ies {subdirs} that move_
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/728ce54f64142769.
Report an issue: GitHub.