anthropics/financial-services · error · FileNotFoundError
File not found: {excel_path}
Error message
File not found: {excel_path} What it means
Raised in DCFModelValidator.__init__ of the vertical-plugins (financial-analysis) source copy of validate_dcf.py when Path(excel_path).exists() returns False. The check runs before openpyxl.load_workbook, so the validator never attempts to open a nonexistent workbook. At runtime the message contains the literal path that was passed in.
Source
Thrown at plugins/vertical-plugins/financial-analysis/skills/dcf-model/scripts/validate_dcf.py:26
import json
from pathlib import Path
from typing import Optional
class DCFModelValidator:
"""Validates DCF models for errors and quality issues"""
def __init__(self, excel_path: str):
try:
import openpyxl
except ImportError:
raise ImportError("openpyxl not installed. Run: pip install openpyxl")
self.excel_path = excel_path
self.openpyxl = openpyxl
if not Path(excel_path).exists():
raise FileNotFoundError(f"File not found: {excel_path}")
self.workbook_formulas = openpyxl.load_workbook(excel_path, data_only=False)
self.workbook_values = openpyxl.load_workbook(excel_path, data_only=True)
self.errors = []
self.warnings = []
self.info = []
def validate_all(self) -> dict:
"""
Run all validation checks
Returns:
Dict with validation results
"""
from datetime import datetime
self.check_sheet_structure()
self.check_formula_errors()View on GitHub (pinned to 69cbc81467)
Solutions
- Verify from the script's working directory: ls -l '<path>'; fix the path or CWD accordingly
- Normalize to an absolute path: DCFModelValidator(str(Path(raw).resolve()))
- Clean paths from external sources: raw.strip().strip('"\'') and expand ~ with Path.expanduser()
- If the file should have been generated upstream, inspect that step's output/logs to find where it was actually written
Example fix
# before
validator = DCFModelValidator('exports/dcf_final.xlsx') # FileNotFoundError
# after
from pathlib import Path
p = Path('exports/dcf_final.xlsx').expanduser().resolve()
if not p.is_file():
raise SystemExit(f'Missing model file: {p}')
validator = DCFModelValidator(str(p)) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
p = Path(excel_path).expanduser().resolve()
if not p.is_file():
raise SystemExit(f'Model file not found: {p}')
validator = DCFModelValidator(str(p)) Type guard
def is_valid_model_path(raw: str) -> bool:
p = Path(raw).expanduser()
return p.is_file() and p.suffix.lower() in {'.xlsx', '.xlsm'} Try / catch
try:
validator = DCFModelValidator(path)
except FileNotFoundError as e:
raise SystemExit(f'Could not open model: {e}. Verify the path and that the upstream export produced the file.') Prevention
- Use absolute, resolved paths in automated pipelines
- Validate user/agent-supplied paths (existence + .xlsx extension) before use
- After any export step, assert the output file exists and log its resolved path
When it happens
Trigger: Calling DCFModelValidator(excel_path) where excel_path points to a missing file: wrong CWD for a relative path, typo, wrong case on a case-sensitive FS, or a model that an upstream export/generation step never wrote. The message interpolates the exact constructor argument.
Common situations: Automation that generates a DCF into a temp/output dir and validates from a different CWD; batch scripts looping over filenames where one is absent; paths quoted or whitespace-padded from CLI args or agent output; files deleted by concurrent cleanup before validation runs.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- File not found: {excel_path}
- File not found: {excel_path}
- openpyxl not installed. Run: pip install openpyxl
- openpyxl not installed. Run: pip install openpyxl
- openpyxl not installed. Run: pip install openpyxl
AI-assisted analysis of anthropics/financial-services@69cbc81467 (2026-08-27).
Data as JSON: /api/errors/b546812469601d38.
Report an issue: GitHub.