{"record":{"id":"812e0fee85dac73d","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"attributeerror-in-personalinformation-e","errorCode":null,"errorMessage":"AttributeError in PersonalInformation: {e}","messagePattern":"AttributeError in PersonalInformation: (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/resume.py","lineNumber":131,"sourceCode":"                for ed in data['education_details']:\n                    if 'exam' in ed:\n                        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)","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/resume.py#L113-L149","documentation":"The wrapper around PersonalInformation(**data) caught an AttributeError — the input dict (or a nested value) is missing an attribute the construction path expects. This typically happens when `data` is not actually a dict (e.g. a string or None) and code tries attribute-style access, or a __post_init__ validator accesses self.<field> on a misconfigured dataclass.","triggerScenarios":"Passing a non-dict (string, None, object) as `data` so that internal handling raises AttributeError; a __post_init__ referencing an attribute deleted/renamed in the dataclass definition.","commonSituations":"JSON parse returned a scalar/None instead of an object; refactoring the dataclass removed a field still referenced elsewhere; nested structures assumed to be objects but are strings.","solutions":["Check the chained original exception (`from e`) to see which attribute was missing.","Guard at the top: if not isinstance(data, dict): raise a clear ValueError with the received type.","Fix or remove the stale attribute reference in __post_init__ or the dataclass.","Ensure the upstream parser actually yields a dict for personal_information."],"exampleFix":"// before\n_process_personal_information(json.loads(text))  # text may decode to a string\n\n# after\ndata = json.loads(text)\nif not isinstance(data, dict):\n    raise ValueError(f\"expected object for personal_information, got {type(data).__name__}\")\n_process_personal_information(data)","handlingStrategy":"type-guard","validationCode":"if not isinstance(data, dict):\n    raise ValueError(f\"personal_information must be a dict, got {type(data).__name__}\")","typeGuard":"def is_dict_payload(x: Any) -> TypeGuard[dict]:\n    return isinstance(x, dict)","tryCatchPattern":"try:\n    pi = _process_personal_information(data)\nexcept AttributeError as e:\n    if 'object has no attribute' in str(e):\n        logger.error(\"payload is not a dict: %s\", e.__cause__ or e)\n    raise","preventionTips":["Validate json.loads output type before passing downstream","Never assume extraction output is an object; check type first","Log the offending payload type on failure"],"tags":["dataclass","attributeerror","python","schema-validation"],"backgroundTag":"attributeerror-on-dict-construction","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}