{"record":{"id":"7cfa139ead0812bc","repo":"zed-industries/zed","slug":"untracked-files-are-present-and-will-not-be-includ","errorCode":null,"errorMessage":"untracked files are present and will NOT be included in the build patch.\nCommit/remove them, or pass --allow-untracked to proceed anyway.\n{preview}","messagePattern":"untracked files are present and will NOT be included in the build patch\\.\nCommit/remove them, or pass --allow-untracked to proceed anyway\\.\n(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"crates/eval_cli/zed_eval/source.py","lineNumber":242,"sourceCode":"    pre_resolved_base_sha: str | None = None,\n) -> tuple[dict[str, Any], str]:\n    # `pre_resolved_base_sha` is a canonical SHA already resolved against the\n    # remote (see `resolve_remote_ref`); it must be used verbatim because the\n    # launcher may not have that commit fetched locally to `rev-parse`.\n    if pre_resolved_base_sha:\n        resolved_base_sha = pre_resolved_base_sha\n    elif base_sha:\n        resolved_base_sha = resolve_git_ref(base_sha)\n    else:\n        resolved_base_sha = current_base_sha()\n    resolved_repo_url = repo_url or DEFAULT_REPO_URL\n    patch = read_patch(patch_path, resolved_base_sha, clean=clean)\n    patch_sha256 = sha256_text(patch) if patch.strip() else None\n    untracked = [] if clean else untracked_files()\n    is_dirty = bool(patch.strip())\n\n    if untracked and not allow_untracked:\n        raise ValueError(format_untracked_warning(untracked))\n\n    if require_clean and is_dirty:\n        raise ValueError(\n            \"tracked changes are present. Commit or stash them, or omit --require-clean.\"\n        )\n\n    return {\n        \"schema\": SOURCE_SCHEMA_VERSION,\n        \"type\": \"git_patch\",\n        \"repo_url\": resolved_repo_url,\n        \"base_sha\": resolved_base_sha,\n        \"base_ref\": source_label or (base_sha if clean else current_ref_name()),\n        \"patch_sha256\": patch_sha256,\n        \"is_dirty\": is_dirty,\n        \"patch_path\": \"source.patch\" if patch.strip() else None,\n        \"untracked_files\": untracked,\n        \"untracked_files_included\": False,\n        \"allow_untracked\": allow_untracked,","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/eval_cli/zed_eval/source.py#L224-L260","documentation":"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.","triggerScenarios":"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.","commonSituations":"Prototyping with new source files forgotten before the build; build outputs not covered by .gitignore; dirty checkouts on shared machines.","solutions":["Run git status, then commit or remove the listed files (usually the right fix)","Add patterns to .gitignore if the files are generated junk","Pass --allow-untracked when the omissions are intentional","Use --clean to ignore worktree state entirely when building from a patch file"],"exampleFix":"# before\n# ValueError: untracked files are present and will NOT be included in the build patch\n\n# after\ngit add crates/new_module.rs && git commit -m \"add new module\"\n# or, when the omission is fine:\nzed-eval build --allow-untracked","handlingStrategy":"validation","validationCode":"import subprocess\n\nlines = subprocess.run([\"git\", \"status\", \"--porcelain\", \"--untracked-files=normal\"], capture_output=True, text=True).stdout.splitlines()\nuntracked = [line[3:] for line in lines if line.startswith(\"??\")]\nif untracked and not allow_untracked:\n    raise SystemExit(f\"commit or remove untracked files first: {untracked}\")","typeGuard":null,"tryCatchPattern":"try:\n    source = build_git_patch_source(...)\nexcept ValueError as err:\n    if \"untracked\" in str(err):\n        # decide: commit the files, or rebuild with allow_untracked=True\n        source = build_git_patch_source(..., allow_untracked=True)\n    else:\n        raise","preventionTips":["Run git status before building sources","Keep .gitignore current for generated files","Treat this guard as a feature — a silently incomplete build patch is worse"],"tags":["git","untracked-files","worktree","build-patch"],"backgroundTag":"untracked-files-in-worktree","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}