{"record":{"id":"65036f161ca6322f","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"missing-field-in-experience-details-e","errorCode":null,"errorMessage":"Missing field in experience details: {e}","messagePattern":"Missing field in experience details: (.+?)","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/resume.py","lineNumber":180,"sourceCode":"        for exp in data:\n            try:\n                key_responsibilities = [\n                    Responsibility(description=list(resp.values())[0])\n                    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":162,"sourceCodeEnd":197,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/resume.py#L162-L197","documentation":"A required key is missing from an experience entry — ExperienceDetails construction uses direct indexing exp['industry'] (and similar) while optional fields use .get(). When the source dict lacks one of the subscripted keys, KeyError propagates and is re-raised with this message; the chained exception names the exact key.","triggerScenarios":"An element of the experience list missing 'industry' or another directly-indexed required key, e.g. exp = {'job_title': 'Dev'} without 'industry'.","commonSituations":"Sparse experience records where candidates omit industry; LLM extraction dropping rarely-filled fields; schema versions where the field became required.","solutions":["Read the chained KeyError for the missing key name; add it to the data or switch to exp.get('industry') if the field is optional.","Pre-validate: required = {'job_title', 'company', 'industry', ...}; assert required <= exp.keys().","Give the dataclass field a default (Optional[str] = None) if the data is legitimately incomplete."],"exampleFix":"// before\nexperience = ExperienceDetails(industry=exp['industry'], ...)\n\n# after\nexperience = ExperienceDetails(industry=exp.get('industry'), ...)  # if optional","handlingStrategy":"validation","validationCode":"REQUIRED_EXP = {'industry'}  # keys accessed via exp[...]\n\ndef validate_experience_entry(exp: dict):\n    if not isinstance(exp, dict):\n        raise ValueError(f\"experience entry must be dict, got {type(exp).__name__}\")\n    missing = REQUIRED_EXP - exp.keys()\n    if missing:\n        raise ValueError(f\"experience entry missing: {sorted(missing)}\")","typeGuard":"def is_experience_entry(x: Any) -> TypeGuard[dict]:\n    return isinstance(x, dict)","tryCatchPattern":"try:\n    exp_list = _process_experience_details(data)\nexcept KeyError as e:\n    logger.warning(\"experience missing %s; skipping section\", e.args[0])\n    exp_list = []","preventionTips":["Use exp.get('industry') for genuinely optional fields","Give dataclass fields defaults for sparse data","Validate required keys before processing"],"tags":["keyerror","dataclass","schema-validation","python"],"backgroundTag":"missing-dict-key","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}