{"record":{"id":"f6e79e0490463f9a","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"an-unexpected-error-occurred-while-processing-self","errorCode":null,"errorMessage":"An unexpected error occurred while processing self_identification.","messagePattern":"An unexpected error occurred while processing self_identification\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/job_application_profile.py","lineNumber":98,"sourceCode":"            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\n        except AttributeError as e:\n            logger.error(f\"Attribute error in legal_authorization processing: {e}\")\n            raise AttributeError(\"Attribute error in legal_authorization processing.\") from e\n        except Exception as e:\n            logger.error(f\"An unexpected error occurred while processing legal_authorization: {e}\")\n            raise RuntimeError(\"An unexpected error occurred while processing legal_authorization.\") from e","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/job_application_profile.py#L80-L116","documentation":"Catch-all RuntimeError from the self_identification try block in JobApplicationProfile.__init__: any exception that is not KeyError/TypeError/AttributeError while building SelfIdentification is re-raised as this generic RuntimeError. The original exception is chained, so the actual failure is only visible via __cause__ or logs. It almost always indicates a bug or unexpected value type deep in nested model constructors.","triggerScenarios":"SelfIdentification (or a nested model) raising ValueError, IndexError, or a custom exception during **data['self_identification'] construction; anything outside the three specific except clauses.","commonSituations":"Version drift between resume data and schema classes (a nested validator now raises ValueError); date parsing or enum coercion failures inside nested constructors; partially migrated data files.","solutions":["Read the chained original exception (raise ... from e) to identify the true failing field/validator.","Reproduce with the same data dict constructing SelfIdentification directly in a REPL.","Fix the offending value or validator, then retry JobApplicationProfile construction.","Add a targeted except clause for the real exception type instead of relying on the generic handler."],"exampleFix":"# before\ntry:\n    profile = JobApplicationProfile(**data)\nexcept RuntimeError as e:\n    pass  # cause unknown\n\n# after\ntry:\n    profile = JobApplicationProfile(**data)\nexcept RuntimeError as e:\n    logging.error(\"root cause: %r\", e.__cause__)\n    raise","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    profile = JobApplicationProfile(**data)\nexcept RuntimeError as e:\n    cause = e.__cause__\n    if 'self_identification' in str(e):\n        handle_section_failure('self_identification', cause)","preventionTips":["Pin library versions so nested validators match your data","Dry-run each nested constructor on sample data in tests","Keep chained exceptions intact when re-raising"],"tags":["python","runtime-error","schema-validation","constructor"],"backgroundTag":"schema-validation-failed","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}