feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · KeyError
Missing field in education details: {e}
Error message
Missing field in education details: {e} What it means
Raised when building an EducationDetails entry and a required key is accessed with exp-style subscripting (edu['field'] or similar) on a dict that lacks it. The original KeyError names the exact missing key in the chained message. It means the education entry in the input list is incomplete relative to what the constructor path requires.
Source
Thrown at src/resume_schemas/resume.py:151
raise Exception(f"Unexpected error in PersonalInformation processing: {e}") from e
def _process_education_details(self, data: List[Dict[str, Any]]) -> List[EducationDetails]:
education_list = []
for edu in data:
try:
exams = [Exam(name=k, grade=v) for k, v in edu.get('exam', {}).items()]
education = EducationDetails(
education_level=edu.get('education_level'),
institution=edu.get('institution'),
field_of_study=edu.get('field_of_study'),
final_evaluation_grade=edu.get('final_evaluation_grade'),
start_date=edu.get('start_date'),
year_of_completion=edu.get('year_of_completion'),
exam=exams
)
education_list.append(education)
except KeyError as e:
raise KeyError(f"Missing field in education details: {e}") from e
except TypeError as e:
raise TypeError(f"Invalid data for Education: {e}") from e
except AttributeError as e:
raise AttributeError(f"AttributeError in Education: {e}") from e
except Exception as e:
raise Exception(f"Unexpected error in Education processing: {e}") from e
return education_list
def _process_experience_details(self, data: List[Dict[str, Any]]) -> List[ExperienceDetails]:
experience_list = []
for exp in data:
try:
key_responsibilities = [
Responsibility(description=list(resp.values())[0])
for resp in exp.get('key_responsibilities', [])
]
skills_acquired = [str(skill) for skill in exp.get('skills_acquired', [])]
experience = ExperienceDetails(View on GitHub (pinned to 79155b52fa)
Solutions
- Read the chained KeyError to get the missing key name; either supply it in the data or switch that access to edu.get('key') with a sensible default.
- Pre-validate each education dict: required = {'school', ...}; missing = required - edu.keys().
- If the field is genuinely optional, give the dataclass field a default (e.g. Optional[str] = None).
Example fix
// before
education = EducationDetails(school=edu['school'], ...)
# after
education = EducationDetails(school=edu.get('school'), ...) # if optional Defensive patterns
Strategy: validation
Validate before calling
REQUIRED_EDU = {'school'} # adjust to the keys your pipeline indexes directly
def validate_education_entry(edu: dict):
if not isinstance(edu, dict):
raise ValueError(f"education entry must be dict, got {type(edu).__name__}")
missing = REQUIRED_EDU - edu.keys()
if missing:
raise ValueError(f"education entry missing: {sorted(missing)}") Type guard
def is_education_entry(x: Any) -> TypeGuard[dict]:
return isinstance(x, dict) Try / catch
try:
edu_list = _process_education_details(data)
except KeyError as e:
logger.warning("education entry missing %s; skipping section", e.args[0])
edu_list = [] Prevention
- Use .get() with defaults for optional resume fields
- Validate required keys per entry before processing
- Default education fields to None in the dataclass
When it happens
Trigger: An element of the education list lacks a required key such as 'school' or 'degree' — the exam parsing uses .get() but required fields use direct indexing somewhere in the EducationDetails construction path.
Common situations: Partial education data from OCR/LLM extraction; optional semesters where one entry only has exam grades; schema where start_date/year_of_completion are optional via .get() but other fields are not.
Related errors
- Missing field in experience details: {e}
- Attribute error in self_identification processing.
- Required field {e} is missing in legal_authorization data.
- Invalid data for PersonalInformation: {e}
- AttributeError in PersonalInformation: {e}
AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28).
Data as JSON: /api/errors/f29682224529ccf7.
Report an issue: GitHub.