{"record":{"id":"6ad77ec5a667fd45","repo":"google-gemini/gemini-cli","slug":"required-prompt-file-missing-at-prompt-file","errorCode":null,"errorMessage":"Required prompt file missing at: {PROMPT_FILE}","messagePattern":"Required prompt file missing at: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"critical","filePath":"tools/caretaker-agent/evals/triage/helpers/generate_golden_spec.py","lineNumber":52,"sourceCode":"    clean = raw_text.strip()\n    if clean.startswith(\"```\"):\n        clean = clean.split(\"\\n\", 1)[-1].rsplit(\"\\n\", 1)[0].strip()\n    try:\n        data = json.loads(clean, strict=False)\n    except Exception:\n        cleaned = re.sub(r'\\\\(?![/\"bfnrtu]|u[0-9a-fA-F]{4})', r'\\\\\\\\', re.sub(r\"(?<!\\\\)\\\\'\", \"'\", clean))\n        data = json.loads(cleaned, strict=False)\n\n    if not isinstance(data, dict):\n        raise ValueError(f\"Expected JSON object from LLM, but got {type(data).__name__}. Raw output:\\n{raw_text}\")\n\n    return data\n\n\ndef _load_system_instruction() -> str:\n    \"\"\"Loads prompt instructions from generate_golden_spec.md.\"\"\"\n    if not PROMPT_FILE.exists():\n        raise FileNotFoundError(f\"Required prompt file missing at: {PROMPT_FILE}\")\n    with open(PROMPT_FILE, \"r\", encoding=\"utf-8\") as f:\n        return f.read()\n\n\ndef generate_golden_spec(owner: str, repo: str, issue_number: int, issue_data: dict, pr_data: dict) -> dict:\n    \"\"\"\n    Invokes the Antigravity SDK (google.antigravity) Agent using generate_golden_spec.md\n    instructions to synthesize a clean, high-precision Workable Spec JSON and its rationale.\n    Returns a dict with keys: 'workable_spec' and 'golden_spec_rationale'.\n    \"\"\"\n    system_instruction = _load_system_instruction()\n\n    # Filter out lockfiles and non-code noise from diff preview\n    raw_diff = pr_data.get(\"diff\", \"\")\n    filtered_diff_lines = []\n    skip_file = False\n    for line in raw_diff.split(\"\\n\"):\n        if line.startswith(\"diff --git\"):","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/tools/caretaker-agent/evals/triage/helpers/generate_golden_spec.py#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Confirm generate_golden_spec.md exists in evals/triage/helpers/ alongside generate_golden_spec.py.","Check .dockerignore and build context to ensure .md files are included in the Cloud Run image.","On case-sensitive systems, verify the filename casing exactly matches 'generate_golden_spec.md'.","Run: python -c \"from pathlib import Path; p=Path('evals/triage/helpers/generate_golden_spec.md'); print(p, p.exists())\" from the repo root."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nPROMPT_FILE = Path(__file__).parent / 'generate_golden_spec.md'\n\ndef ensure_prompt_file() -> None:\n    if not PROMPT_FILE.exists():\n        raise FileNotFoundError(f'Required prompt file missing at: {PROMPT_FILE}')\n\n# Call ensure_prompt_file() at startup or in CI before invoking generate_golden_spec.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include *.md files in Docker builds (check .dockerignore) and package data.","Add a CI step that asserts generate_golden_spec.md exists in the helpers directory.","Treat prompt files as code: version-control and review them alongside the Python modules."],"tags":["file-not-found","packaging","golden-spec","prompt","python"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}