{"record":{"id":"4dfd2c5dfb246246","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"error-in-self-identification-data-e","errorCode":null,"errorMessage":"Error in self_identification data: {e}","messagePattern":"Error in self_identification data: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/job_application_profile.py","lineNumber":92,"sourceCode":"        except Exception as e:\n            logger.error(f\"Unexpected error occurred while parsing the YAML file: {e}\")\n            raise RuntimeError(\"An unexpected error occurred while parsing the YAML file.\") from e\n\n        if not isinstance(data, dict):\n            logger.error(f\"YAML data must be a dictionary, received: {type(data)}\")\n            raise TypeError(\"YAML data must be a dictionary.\")\n\n        # Process self_identification\n        try:\n            logger.debug(\"Processing self_identification\")\n            self.self_identification = SelfIdentification(**data['self_identification'])\n            logger.debug(f\"self_identification processed: {self.self_identification}\")\n        except KeyError as e:\n            logger.error(f\"Required field {e} is missing in self_identification data.\")\n            raise KeyError(f\"Required field {e} is missing in self_identification data.\") from e\n        except TypeError as e:\n            logger.error(f\"Error in self_identification data: {e}\")\n            raise TypeError(f\"Error in self_identification data: {e}\") from e\n        except AttributeError as e:\n            logger.error(f\"Attribute error in self_identification processing: {e}\")\n            raise AttributeError(\"Attribute error in self_identification processing.\") from e\n        except Exception as e:\n            logger.error(f\"An unexpected error occurred while processing self_identification: {e}\")\n            raise RuntimeError(\"An unexpected error occurred while processing self_identification.\") from e\n\n        # Process legal_authorization\n        try:\n            logger.debug(\"Processing legal_authorization\")\n            self.legal_authorization = LegalAuthorization(**data['legal_authorization'])\n            logger.debug(f\"legal_authorization processed: {self.legal_authorization}\")\n        except KeyError as e:\n            logger.error(f\"Required field {e} is missing in legal_authorization data.\")\n            raise KeyError(f\"Required field {e} is missing in legal_authorization data.\") from e\n        except TypeError as e:\n            logger.error(f\"Error in legal_authorization data: {e}\")\n            raise TypeError(f\"Error in legal_authorization data: {e}\") from e","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/job_application_profile.py#L74-L110","documentation":"When building SelfIdentification(**data['self_identification']) raises TypeError (e.g. an unexpected keyword argument because the YAML has a key the dataclass doesn't accept, or the value is not a mapping), the constructor re-raises TypeError('Error in self_identification data: ...') with the cause chained.","triggerScenarios":"self_identification in YAML contains keys that don't match SelfIdentification's fields, or data['self_identification'] is not a dict (a string/list), making the ** unpacking fail with TypeError.","commonSituations":"Typos or extra keys in the YAML section, schema drift after upgrading the library (renamed dataclass fields), or self_identification written as a scalar instead of a mapping.","solutions":["Read the chained TypeError message: it names the unexpected keyword argument or unpacking problem.","Align YAML keys with the SelfIdentification dataclass fields exactly (remove extras, fix typos, rename to current schema).","Ensure self_identification is a nested mapping, not a scalar or list."],"exampleFix":"# before\nself_identification:\n  sex: 'Male'   # wrong/legacy key -> TypeError\n# after\nself_identification:\n  gender: 'Male'  # matches the dataclass field","handlingStrategy":"type-guard","validationCode":"import yaml\nsi = (yaml.safe_load(text) or {}).get('self_identification')\nassert isinstance(si, dict), 'self_identification must be a mapping'\nextra = set(si) - ALLOWED_FIELDS  # fields of SelfIdentification\nassert not extra, f'unexpected keys: {extra}'","typeGuard":"def self_identification_valid(data: dict, allowed: set) -> bool:\n    si = data.get('self_identification')\n    return isinstance(si, dict) and set(si) <= allowed","tryCatchPattern":"try:\n    profile = JobApplicationProfile(text)\nexcept TypeError as e:\n    if 'self_identification' in str(e):\n        logger.error('Bad self_identification keys: %s', e.__cause__)\n        raise ConfigError('Fix self_identification keys in resume YAML') from e\n    raise","preventionTips":["Mirror the dataclass field names exactly in YAML; avoid extra keys.","After library upgrades, re-check the SelfIdentification schema and migrate YAML keys."],"tags":["python","yaml","type-mismatch","dataclass","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}