{"record":{"id":"63b1c22ecf4ae781","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"unexpected-error-in-personalinformation-processing","errorCode":null,"errorMessage":"Unexpected error in PersonalInformation processing: {e}","messagePattern":"Unexpected error in PersonalInformation processing: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/resume.py","lineNumber":133,"sourceCode":"                        ed['exam'] = self.normalize_exam_format(ed['exam'])\n\n            # Create an instance of Resume from the parsed data\n            super().__init__(**data)\n        except yaml.YAMLError as e:\n            raise ValueError(\"Error parsing YAML file.\") from e\n        except Exception as e:\n            raise Exception(f\"Unexpected error while parsing YAML: {e}\") from e\n\n\n    def _process_personal_information(self, data: Dict[str, Any]) -> PersonalInformation:\n        try:\n            return PersonalInformation(**data)\n        except TypeError as e:\n            raise TypeError(f\"Invalid data for PersonalInformation: {e}\") from e\n        except AttributeError as e:\n            raise AttributeError(f\"AttributeError in PersonalInformation: {e}\") from e\n        except Exception as e:\n            raise Exception(f\"Unexpected error in PersonalInformation processing: {e}\") from e\n\n    def _process_education_details(self, data: List[Dict[str, Any]]) -> List[EducationDetails]:\n        education_list = []\n        for edu in data:\n            try:\n                exams = [Exam(name=k, grade=v) for k, v in edu.get('exam', {}).items()]\n                education = EducationDetails(\n                    education_level=edu.get('education_level'),\n                    institution=edu.get('institution'),\n                    field_of_study=edu.get('field_of_study'),\n                    final_evaluation_grade=edu.get('final_evaluation_grade'),\n                    start_date=edu.get('start_date'),\n                    year_of_completion=edu.get('year_of_completion'),\n                    exam=exams\n                )\n                education_list.append(education)\n            except KeyError as e:\n                raise KeyError(f\"Missing field in education details: {e}\") from e","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/resume.py#L115-L151","documentation":"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`.","triggerScenarios":"PersonalInformation.__post_init__ raising ValueError on invalid values; a nested dataclass/validator raising arbitrary exceptions during **data construction.","commonSituations":"Custom validators added to the dataclass; enum parsing of strings; date parsing failures inside __post_init__.","solutions":["Inspect e.__cause__ (the chained original) to identify the real exception and message.","Reproduce with the exact dict locally: PersonalInformation(**data).","Fix or relax the failing validator, or pre-clean the offending values in the input dict.","If a specific exception type occurs frequently, add a dedicated except clause before the generic one for a clearer message."],"exampleFix":"// before\nexcept Exception as e:\n    raise Exception(f\"Unexpected error in PersonalInformation processing: {e}\") from e\n\n# after\nexcept ValueError as e:\n    raise ValueError(f\"Invalid value in PersonalInformation: {e}\") from e\nexcept Exception as e:\n    raise RuntimeError(f\"Unexpected error in PersonalInformation processing: {e}\") from e","handlingStrategy":"try-catch","validationCode":"# no full pre-validation possible for arbitrary nested failures; at minimum check dict-ness\nassert isinstance(data, dict), \"personal_information payload must be a dict\"","typeGuard":null,"tryCatchPattern":"try:\n    pi = _process_personal_information(data)\nexcept Exception as e:\n    cause = e.__cause__ or e\n    logger.error(\"PersonalInformation failed (%s): %s\", type(cause).__name__, cause)\n    if isinstance(cause, ValueError):\n        # treat as data-quality issue: skip section or use defaults\n        ...\n    raise","preventionTips":["Always inspect __cause__ on wrapped exceptions","Add targeted except clauses for known failure types","Unit-test constructors with representative extraction payloads"],"tags":["dataclass","catch-all","python"],"backgroundTag":"nested-constructor-exception","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}