google-gemini/gemini-cli · critical · FileNotFoundError

Required prompt file missing at: {PROMPT_FILE}

Error message

Required prompt file missing at: {PROMPT_FILE}

What it means

This FileNotFoundError is raised by _load_system_instruction() when the generate_golden_spec.md prompt file does not exist at the expected sibling path (PROMPT_FILE = Path(__file__).parent / 'generate_golden_spec.md'). The prompt file holds the system instructions fed to the Antigravity agent, so its absence makes spec generation impossible. It is a packaging/deployment integrity check.

Source

Thrown at tools/caretaker-agent/evals/triage/helpers/generate_golden_spec.py:52

    clean = raw_text.strip()
    if clean.startswith("```"):
        clean = clean.split("\n", 1)[-1].rsplit("\n", 1)[0].strip()
    try:
        data = json.loads(clean, strict=False)
    except Exception:
        cleaned = re.sub(r'\\(?![/"bfnrtu]|u[0-9a-fA-F]{4})', r'\\\\', re.sub(r"(?<!\\)\\'", "'", clean))
        data = json.loads(cleaned, strict=False)

    if not isinstance(data, dict):
        raise ValueError(f"Expected JSON object from LLM, but got {type(data).__name__}. Raw output:\n{raw_text}")

    return data


def _load_system_instruction() -> str:
    """Loads prompt instructions from generate_golden_spec.md."""
    if not PROMPT_FILE.exists():
        raise FileNotFoundError(f"Required prompt file missing at: {PROMPT_FILE}")
    with open(PROMPT_FILE, "r", encoding="utf-8") as f:
        return f.read()


def generate_golden_spec(owner: str, repo: str, issue_number: int, issue_data: dict, pr_data: dict) -> dict:
    """
    Invokes the Antigravity SDK (google.antigravity) Agent using generate_golden_spec.md
    instructions to synthesize a clean, high-precision Workable Spec JSON and its rationale.
    Returns a dict with keys: 'workable_spec' and 'golden_spec_rationale'.
    """
    system_instruction = _load_system_instruction()

    # Filter out lockfiles and non-code noise from diff preview
    raw_diff = pr_data.get("diff", "")
    filtered_diff_lines = []
    skip_file = False
    for line in raw_diff.split("\n"):
        if line.startswith("diff --git"):

View on GitHub (pinned to 5024443c72)

Solutions

  1. Confirm generate_golden_spec.md exists in evals/triage/helpers/ alongside generate_golden_spec.py.
  2. Check .dockerignore and build context to ensure .md files are included in the Cloud Run image.
  3. On case-sensitive systems, verify the filename casing exactly matches 'generate_golden_spec.md'.
  4. Run: python -c "from pathlib import Path; p=Path('evals/triage/helpers/generate_golden_spec.md'); print(p, p.exists())" from the repo root.
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

PROMPT_FILE = Path(__file__).parent / 'generate_golden_spec.md'

def ensure_prompt_file() -> None:
    if not PROMPT_FILE.exists():
        raise FileNotFoundError(f'Required prompt file missing at: {PROMPT_FILE}')

# Call ensure_prompt_file() at startup or in CI before invoking generate_golden_spec.

Prevention

When it happens

Trigger: generate_golden_spec() is called and _load_system_instruction() finds PROMPT_FILE.exists() is False. Happens when the helpers/ directory was deployed without the .md file, the file was renamed or moved, or the module is imported from a different install location where the sibling file is absent.

Common situations: The .md file was excluded from a Docker context by a .dockerignore pattern. A git operation or merge deleted the file. The package was installed in editable mode from a different checkout. The file exists with different casing on a case-sensitive filesystem (Generate_Golden_Spec.md).

Related errors


AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12). Data as JSON: /api/errors/6ad77ec5a667fd45. Report an issue: GitHub.