feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · Exception

Unexpected error in PersonalInformation processing: {e}

Error message

Unexpected error in PersonalInformation processing: {e}

What it means

Catch-all: something other than TypeError/AttributeError went wrong while building PersonalInformation — often a ValueError from a validating __post_init__, a KeyError from a required nested lookup, or an exception inside a nested model constructor. The original exception is preserved as __cause__ via `raise ... from e`.

Source

Thrown at src/resume_schemas/resume.py:133

                        ed['exam'] = self.normalize_exam_format(ed['exam'])

            # Create an instance of Resume from the parsed data
            super().__init__(**data)
        except yaml.YAMLError as e:
            raise ValueError("Error parsing YAML file.") from e
        except Exception as e:
            raise Exception(f"Unexpected error while parsing YAML: {e}") from e


    def _process_personal_information(self, data: Dict[str, Any]) -> PersonalInformation:
        try:
            return PersonalInformation(**data)
        except TypeError as e:
            raise TypeError(f"Invalid data for PersonalInformation: {e}") from e
        except AttributeError as e:
            raise AttributeError(f"AttributeError in PersonalInformation: {e}") from e
        except Exception as e:
            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

View on GitHub (pinned to 79155b52fa)

Solutions

  1. Inspect e.__cause__ (the chained original) to identify the real exception and message.
  2. Reproduce with the exact dict locally: PersonalInformation(**data).
  3. Fix or relax the failing validator, or pre-clean the offending values in the input dict.
  4. If a specific exception type occurs frequently, add a dedicated except clause before the generic one for a clearer message.

Example fix

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

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

Strategy: try-catch

Validate before calling

# no full pre-validation possible for arbitrary nested failures; at minimum check dict-ness
assert isinstance(data, dict), "personal_information payload must be a dict"

Try / catch

try:
    pi = _process_personal_information(data)
except Exception as e:
    cause = e.__cause__ or e
    logger.error("PersonalInformation failed (%s): %s", type(cause).__name__, cause)
    if isinstance(cause, ValueError):
        # treat as data-quality issue: skip section or use defaults
        ...
    raise

Prevention

When it happens

Trigger: PersonalInformation.__post_init__ raising ValueError on invalid values; a nested dataclass/validator raising arbitrary exceptions during **data construction.

Common situations: Custom validators added to the dataclass; enum parsing of strings; date parsing failures inside __post_init__.

Related errors


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