zed-industries/zed · warning · ValueError

untracked files are present and will NOT be included in the…

Error message

untracked files are present and will NOT be included in the build patch.
Commit/remove them, or pass --allow-untracked to proceed anyway.
{preview}

What it means

When building a git_patch source, the tool refuses to proceed if the worktree contains untracked files: git-diff-based patches do not capture them, so the built artifact would silently omit code. Unless allow_untracked was passed, it raises this ValueError with a preview of the offending files.

Solutions

  1. Run git status, then commit or remove the listed files (usually the right fix)
  2. Add patterns to .gitignore if the files are generated junk
  3. Pass --allow-untracked when the omissions are intentional
  4. Use --clean to ignore worktree state entirely when building from a patch file

Example fix

# before
# ValueError: untracked files are present and will NOT be included in the build patch

# after
git add crates/new_module.rs && git commit -m "add new module"
# or, when the omission is fine:
zed-eval build --allow-untracked
Defensive patterns

Strategy: validation

Validate before calling

import subprocess

lines = subprocess.run(["git", "status", "--porcelain", "--untracked-files=normal"], capture_output=True, text=True).stdout.splitlines()
untracked = [line[3:] for line in lines if line.startswith("??")]
if untracked and not allow_untracked:
    raise SystemExit(f"commit or remove untracked files first: {untracked}")

Try / catch

try:
    source = build_git_patch_source(...)
except ValueError as err:
    if "untracked" in str(err):
        # decide: commit the files, or rebuild with allow_untracked=True
        source = build_git_patch_source(..., allow_untracked=True)
    else:
        raise

Prevention

When it happens

Trigger: Running the source build with new files never git-added; generated artifacts (logs, configs, scratch scripts) landing in the worktree; the clean=False path with untracked_files() returning a non-empty list.

Common situations: Prototyping with new source files forgotten before the build; build outputs not covered by .gitignore; dirty checkouts on shared machines.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/7cfa139ead0812bc. Report an issue: GitHub.

Appendix: source

Thrown at crates/eval_cli/zed_eval/source.py:242

    pre_resolved_base_sha: str | None = None,
) -> tuple[dict[str, Any], str]:
    # `pre_resolved_base_sha` is a canonical SHA already resolved against the
    # remote (see `resolve_remote_ref`); it must be used verbatim because the
    # launcher may not have that commit fetched locally to `rev-parse`.
    if pre_resolved_base_sha:
        resolved_base_sha = pre_resolved_base_sha
    elif base_sha:
        resolved_base_sha = resolve_git_ref(base_sha)
    else:
        resolved_base_sha = current_base_sha()
    resolved_repo_url = repo_url or DEFAULT_REPO_URL
    patch = read_patch(patch_path, resolved_base_sha, clean=clean)
    patch_sha256 = sha256_text(patch) if patch.strip() else None
    untracked = [] if clean else untracked_files()
    is_dirty = bool(patch.strip())

    if untracked and not allow_untracked:
        raise ValueError(format_untracked_warning(untracked))

    if require_clean and is_dirty:
        raise ValueError(
            "tracked changes are present. Commit or stash them, or omit --require-clean."
        )

    return {
        "schema": SOURCE_SCHEMA_VERSION,
        "type": "git_patch",
        "repo_url": resolved_repo_url,
        "base_sha": resolved_base_sha,
        "base_ref": source_label or (base_sha if clean else current_ref_name()),
        "patch_sha256": patch_sha256,
        "is_dirty": is_dirty,
        "patch_path": "source.patch" if patch.strip() else None,
        "untracked_files": untracked,
        "untracked_files_included": False,
        "allow_untracked": allow_untracked,

View on GitHub (pinned to f4178619ac)