langflow-ai/langflow · error · SystemExit
git is not available; cannot check append-only invariant.
Error message
git is not available; cannot check append-only invariant.
What it means
Raised by scripts/migrate/check_migration_append_only.py when it cannot invoke `git` (subprocess raises FileNotFoundError) while trying to `git show` the migration-table JSON at a baseline ref. The script compares current migration entries against the baseline to enforce append-only history; without git there is no baseline, so it exits rather than silently passing.
Source
Thrown at scripts/migrate/check_migration_append_only.py:75
def _git_show(ref: str, relpath: str) -> str | None:
"""Return the contents of ``relpath`` at ``ref``, or ``None`` if absent.
Absence is the common-case on initial introduction of the table file:
the baseline simply doesn't have the file yet, in which case there is
nothing to compare against and the check trivially passes.
"""
try:
completed = subprocess.run( # noqa: S603 - git invoked with a fixed argv list
["git", "show", f"{ref}:{relpath}"], # noqa: S607 - git resolves via PATH like every CI runner
check=False,
capture_output=True,
text=True,
cwd=REPO_ROOT,
)
except FileNotFoundError: # git not on PATH
msg = "git is not available; cannot check append-only invariant."
raise SystemExit(msg) from None
if completed.returncode != 0:
# Most likely: file not present at base ref. We treat that as
# "no baseline" and return None.
return None
return completed.stdout
def _parse(raw: str, *, source: str) -> tuple[list[dict], list[dict]]:
"""Return ``(entries, ambiguous_bare_names)`` from a migration-table JSON.
Both lists default to empty when the field is absent so this script can
compare across baselines that pre-date a given field.
"""
try:
data = json.loads(raw)
except json.JSONDecodeError as exc:
print(f"error: invalid JSON in {source}: {exc}", file=sys.stderr)
raise SystemExit(2) from excView on GitHub (pinned to 976ec789d2)
Solutions
- Install git in the environment (apt-get install -y git / apk add git) and re-run the script
- Verify with `which git` in the exact shell/container the script runs in
- If git is intentionally absent and no baseline is needed, export the repo without a .git directory — the script then treats it as 'no baseline' and passes trivially
- In CI, use a base image that bundles git (e.g. ci- prefixed images)
Example fix
# before — Dockerfile with no git FROM python:3.12-slim RUN pip install -r requirements.txt # after FROM python:3.12-slim RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/* RUN pip install -r requirements.txt
Defensive patterns
Strategy: validation
Validate before calling
import shutil
if shutil.which("git") is None:
print("skipping append-only check: git not installed")
sys.exit(0) # or fail loudly, per your CI policy Try / catch
# script already exits via SystemExit; wrap invocation instead:
import subprocess, sys
r = subprocess.run([sys.executable, "scripts/migrate/check_migration_append_only.py"])
if r.returncode != 0 and shutil.which("git") is None:
print("pre-flight failed: install git in this image") Prevention
- Use CI base images that include git when migration checks run
- Add `which git` to pipeline pre-flight checks
- Document that the script needs a real .git checkout plus git on PATH
When it happens
Trigger: Running the migration check in an environment where git is not installed or not on PATH — minimal CI containers (python:slim without git), some Docker images, or restricted sandboxes — while the checkout includes a .git directory.
Common situations: CI images optimized to Python-only tooling; local venvs launched from GUI launchers that strip PATH; pipelines that archive the repo without .git (that yields the 'no baseline' pass, distinct from this).
Related errors
- error: invalid JSON in {source}: {exc}
- error: {source} top-level value must be an object
- error: {source} entries field must be a list
- error: {source} ambiguous_bare_names field must be a list
- module {__name__!r} has no attribute {attr_name!r}
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/90b3de7077d51ea0.
Report an issue: GitHub.