{"record":{"id":"ff7409e32ccdf1ad","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"required-field-e-is-missing-in-self-identificati","errorCode":null,"errorMessage":"Required field {e} is missing in self_identification data.","messagePattern":"Required field (.+?) is missing in self_identification data\\.","errorType":"validation","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/job_application_profile.py","lineNumber":89,"sourceCode":"        except yaml.YAMLError as e:\n            logger.error(f\"Error parsing YAML file: {e}\")\n            raise ValueError(\"Error parsing YAML file.\") from e\n        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","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/job_application_profile.py#L71-L107","documentation":"While constructing SelfIdentification from data['self_identification'], a missing required mapping key raises KeyError (data['self_identification'] itself absent, or a nested required key). The constructor catches it and re-raises KeyError with the message naming the missing field.","triggerScenarios":"The parsed YAML dict lacks the self_identification key (or one of its required sub-fields), e.g. the resume YAML was trimmed or a field was renamed.","commonSituations":"Incomplete resume templates, schema drift after library updates renaming fields, or hand-editing that deleted a block.","solutions":["Add the missing section/key reported in the message to your YAML (start from the project's example resume YAML).","If fields were renamed by a schema change, migrate your YAML to the current field names.","Validate required keys before constructing JobApplicationProfile."],"exampleFix":"# before\n# resume.yaml without self_identification\n# after\nself_identification:\n  gender: 'Prefer not to say'\n  pronouns: 'Prefer not to say'\n  veteran: 'No'\n  disability: 'No'\n  ethnicity: 'Prefer not to say'","handlingStrategy":"validation","validationCode":"import yaml\ndata = yaml.safe_load(text) or {}\nrequired = ['self_identification', 'personal_info']  # adjust to schema\nmissing = [k for k in required if k not in data]\nassert not missing, f'missing sections: {missing}'","typeGuard":"def has_required_sections(text: str, required=('self_identification',)) -> bool:\n    import yaml\n    data = yaml.safe_load(text)\n    return isinstance(data, dict) and all(k in data for k in required)","tryCatchPattern":"try:\n    profile = JobApplicationProfile(text)\nexcept KeyError as e:\n    if 'self_identification' in str(e):\n        raise ConfigError('Add self_identification to resume YAML') from e\n    raise","preventionTips":["Keep a known-good example resume YAML and diff against it when edits break loading.","Validate required keys with a schema check before constructing profile objects."],"tags":["python","yaml","missing-key","schema"],"backgroundTag":"required-field-missing","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}