google-gemini/gemini-cli · critical · FileNotFoundError
Required judge.md prompt file missing from {PROMPT_FILE.pare
Error message
Required judge.md prompt file missing from {PROMPT_FILE.parent} What it means
This FileNotFoundError is raised at module import time in judge.py when the sibling file judge.md is not found next to judge.py. Because the check and file read happen at top-level (outside any function), importing judge.py itself triggers the error, which means any module importing evaluate_categorization or judge_workable_spec fails to load. The file holds the LLM-as-a-judge system prompt.
Source
Thrown at tools/caretaker-agent/evals/triage/judge.py:21
Provides evaluation functions:
1. evaluate_categorization: Exact match string evaluation for quality & effort.
2. judge_workable_spec: LLM-as-a-Judge grading for Workable Specs matching Golden Spec fidelity (0-2 Rubric Scale) via Gemini API.
"""
import os
import json
from pathlib import Path
from typing import Any, Dict
from dotenv import load_dotenv
load_dotenv()
from google import genai
PROMPT_FILE = Path(__file__).parent / "judge.md"
if not PROMPT_FILE.exists():
raise FileNotFoundError(f"Required judge.md prompt file missing from {PROMPT_FILE.parent}")
with open(PROMPT_FILE, "r", encoding="utf-8") as f:
JUDGE_PROMPT = f.read()
_CLIENT: Any = None
def _get_client() -> genai.Client:
"""Returns thread-safe cached Gemini API client instance."""
global _CLIENT
if _CLIENT is None:
api_key = os.environ.get("GEMINI_API_KEY")
_CLIENT = genai.Client(api_key=api_key)
return _CLIENT
def evaluate_categorization(predicted: Dict[str, Any], expected: Dict[str, Any]) -> Dict[str, Any]:
"""View on GitHub (pinned to 5024443c72)
Solutions
- Confirm judge.md exists at evals/triage/judge.md alongside judge.py.
- If packaging, ensure .md files are included: add 'include *.md' to MANIFEST.in or package_data={'': ['*.md']} in setup.
- Check .dockerignore does not exclude *.md from the build context.
- On case-sensitive filesystems, verify exact casing 'judge.md'.
- Run: ls evals/triage/judge.md to confirm presence before importing.
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
PROMPT_FILE = Path(__file__).parent / 'judge.md'
def judge_prompt_available() -> bool:
return PROMPT_FILE.exists()
# In CI: assert judge_prompt_available() before importing evals.triage.judge. Prevention
- Ensure package_data / MANIFEST.in includes *.md so judge.md ships in distributions.
- Audit .dockerignore to confirm .md files enter the build context.
- Add a CI assertion that judge.md exists in evals/triage/.
- Keep prompt files under version control and reviewed with code changes.
When it happens
Trigger: Any import of evals.triage.judge (directly or via runner.py) when judge.md is missing from the same directory. The check runs once at import, so the exception propagates as an ImportError/ModuleNotFoundError wrapper or a raw FileNotFoundError depending on context.
Common situations: judge.md was deleted, renamed, or not included in a Docker image due to .dockerignore excluding .md files. The package was installed from a wheel/sdist that did not include non-Python data files (missing package_data or MANIFEST.in). Running from a shallow clone or worktree that lacks the file. Case mismatch on case-sensitive filesystems.
Related errors
- Required prompt file missing at: {PROMPT_FILE}
- PromptConfig must define either `systemPrompt` or `initialMe
- Google Antigravity SDK is not installed.
- Agent '{role}' execution failed: {e}
- Command '{cmd_str}' failed with exit code {returncode}
AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12).
Data as JSON: /api/errors/6546383738fab485.
Report an issue: GitHub.