feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · Exception

Unexpected error in Education processing: {e}

Error message

Unexpected error in Education processing: {e}

What it means

Generic fallback for EducationDetails processing when the failure is neither KeyError, TypeError, nor AttributeError — e.g. ValueError from Exam(name=..., grade=...) validation, or exceptions from converters in the construction chain. The true cause is chained via __cause__.

Source

Thrown at src/resume_schemas/resume.py:157

                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(
                    position=exp['position'],
                    company=exp['company'],
                    employment_period=exp['employment_period'],
                    location=exp['location'],
                    industry=exp['industry'],
                    key_responsibilities=key_responsibilities,

View on GitHub (pinned to 79155b52fa)

Solutions

  1. Inspect e.__cause__ for the real exception and message; reproduce with the single offending edu dict.
  2. Fix or relax the underlying validator / pre-clean the value.
  3. Add a specific except clause (e.g. except ValueError) ahead of the generic one for clearer diagnostics.
  4. Consider isolating entries: wrap the body in a per-entry try and collect errors instead of failing the whole list.

Example fix

// before
except Exception as e:
    raise Exception(f"Unexpected error in Education processing: {e}") from e

# after
except ValueError as e:
    raise ValueError(f"Invalid value in Education: {e}") from e
except Exception as e:
    raise RuntimeError(f"Unexpected error in Education processing: {e}") from e
Defensive patterns

Strategy: try-catch

Validate before calling

# minimal sanity check; full prevention not possible for arbitrary nested exceptions
assert all(isinstance(e, dict) for e in data), "education entries must be dicts"

Try / catch

edu_list = []
for edu in data:
    try:
        edu_list.extend(_process_education_details([edu]))
    except Exception as e:
        logger.warning("skipping bad education entry %r: %s", edu, e.__cause__ or e)

Prevention

When it happens

Trigger: Exam or EducationDetails __post_init__ raising ValueError on bad grades/dates; a nested converter choking on an unexpected value type.

Common situations: Custom validators inside the dataclasses; date parsing of 'start_date'; enum coercion.

Related errors


AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28). Data as JSON: /api/errors/4ef72011d80d4b7d. Report an issue: GitHub.