{"record":{"id":"52bff4d90ce69157","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"attributeerror-in-experience-e","errorCode":null,"errorMessage":"AttributeError in Experience: {e}","messagePattern":"AttributeError in Experience: (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/resume.py","lineNumber":184,"sourceCode":"                    for resp in exp.get('key_responsibilities', [])\n                ]\n                skills_acquired = [str(skill) for skill in exp.get('skills_acquired', [])]\n                experience = ExperienceDetails(\n                    position=exp['position'],\n                    company=exp['company'],\n                    employment_period=exp['employment_period'],\n                    location=exp['location'],\n                    industry=exp['industry'],\n                    key_responsibilities=key_responsibilities,\n                    skills_acquired=skills_acquired\n                )\n                experience_list.append(experience)\n            except KeyError as e:\n                raise KeyError(f\"Missing field in experience details: {e}\") from e\n            except TypeError as e:\n                raise TypeError(f\"Invalid data for Experience: {e}\") from e\n            except AttributeError as e:\n                raise AttributeError(f\"AttributeError in Experience: {e}\") from e\n            except Exception as e:\n                raise Exception(f\"Unexpected error in Experience processing: {e}\") from e\n        return experience_list\n\n\n@dataclass\nclass Exam:\n    name: str\n    grade: str\n\n@dataclass\nclass Responsibility:\n    description: str","sourceCodeStart":166,"sourceCodeEnd":197,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/resume.py#L166-L197","documentation":"An AttributeError escaped the per-entry experience processing — most commonly because `exp` (or a nested value like a responsibility item) is not the expected dict/object, so .get()/attribute access fails. The chained original names the attribute and the actual type.","triggerScenarios":"for exp in data where an entry is a string or None → \"'str' object has no attribute 'get'\"; nested dict expected but a scalar supplied for company/skills.","commonSituations":"Mixed extraction output (free-text blurbs mixed with structured entries); nulls in JSON arrays; API returning objects where the code assumes dicts.","solutions":["Inspect e.__cause__ to find the offending object and type.","Normalize the list: entries = [e if isinstance(e, dict) else {} for e in data], or skip invalid entries with a warning.","Add type checks on nested values before attribute/method use."],"exampleFix":"// before\nfor exp in data:\n    industry = exp['industry']\n\n# after\nfor exp in data:\n    if not isinstance(exp, dict):\n        logger.warning('skipping non-dict experience entry: %r', exp)\n        continue\n    industry = exp.get('industry')","handlingStrategy":"type-guard","validationCode":"data = [e for e in data if isinstance(e, dict)]","typeGuard":"def is_experience_list(x: Any) -> TypeGuard[list[dict]]:\n    return isinstance(x, list) and all(isinstance(e, dict) for e in x)","tryCatchPattern":"try:\n    exp_list = _process_experience_details(data)\nexcept AttributeError as e:\n    logger.warning(\"malformed experience entry (%s); skipping\", e)\n    exp_list = []","preventionTips":["Filter non-dict entries before processing","Check nested structures' types before attribute access","Log dropped entries to monitor extraction quality"],"tags":["attributeerror","dataclass","python"],"backgroundTag":"attributeerror-on-dict-construction","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}