{"record":{"id":"73b7a0b2f91f2400","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"an-unexpected-error-occurred-while-processing-lega","errorCode":null,"errorMessage":"An unexpected error occurred while processing legal_authorization.","messagePattern":"An unexpected error occurred while processing legal_authorization\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/job_application_profile.py","lineNumber":116,"sourceCode":"            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\n\n        # Process work_preferences\n        try:\n            logger.debug(\"Processing work_preferences\")\n            self.work_preferences = WorkPreferences(**data['work_preferences'])\n            logger.debug(f\"Work_preferences processed: {self.work_preferences}\")\n        except KeyError as e:\n            logger.error(f\"Required field {e} is missing in work_preferences data.\")\n            raise KeyError(f\"Required field {e} is missing in work_preferences data.\") from e\n        except TypeError as e:\n            logger.error(f\"Error in work_preferences data: {e}\")\n            raise TypeError(f\"Error in work_preferences data: {e}\") from e\n        except AttributeError as e:\n            logger.error(f\"Attribute error in work_preferences processing: {e}\")\n            raise AttributeError(\"Attribute error in work_preferences processing.\") from e\n        except Exception as e:\n            logger.error(f\"An unexpected error occurred while processing work_preferences: {e}\")\n            raise RuntimeError(\"An unexpected error occurred while processing work_preferences.\") from e","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/job_application_profile.py#L98-L134","documentation":"Generic RuntimeError catch-all for the legal_authorization section in JobApplicationProfile.__init__: any exception other than KeyError/TypeError/AttributeError raised while building LegalAuthorization is converted to this message. The true cause is only in the chained exception and the logged message, making it a symptom wrapper rather than a root cause.","triggerScenarios":"Nested validators or coercions inside LegalAuthorization raising ValueError/IndexError/etc.; e.g. parsing a boolean-like string or an unexpected enum value during construction.","commonSituations":"Schema version mismatches between resume files and the library; hand-edited YAML with invalid values for authorization fields; custom subclasses of the models adding validation.","solutions":["Inspect e.__cause__ to get the original exception and stack trace.","Construct LegalAuthorization(**data['legal_authorization']) directly to isolate the failing field.","Fix or sanitize the offending value; extend the except chain with the specific exception type if it recurs."],"exampleFix":"# before\nexcept Exception as e:\n    raise RuntimeError(\"An unexpected error occurred while processing legal_authorization.\") from e\n\n# after (surface the cause)\nexcept Exception as e:\n    raise RuntimeError(f\"Error processing legal_authorization: {e!r}\") from e","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    profile = JobApplicationProfile(**data)\nexcept RuntimeError as e:\n    if 'legal_authorization' in str(e):\n        log.error('root cause: %r', e.__cause__)","preventionTips":["Test each section constructor with real sample payloads","Log chained causes in production","Regenerate fixture resumes after schema upgrades"],"tags":["python","runtime-error","legal-authorization","constructor"],"backgroundTag":"schema-validation-failed","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}