{"record":{"id":"6d8aec789bdcc2eb","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"error-in-work-preferences-data-e","errorCode":null,"errorMessage":"Error in work_preferences data: {e}","messagePattern":"Error in work_preferences data: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/job_application_profile.py","lineNumber":128,"sourceCode":"            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\n\n        # Process availability\n        try:\n            logger.debug(\"Processing availability\")\n            self.availability = Availability(**data['availability'])\n            logger.debug(f\"Availability processed: {self.availability}\")\n        except KeyError as e:\n            logger.error(f\"Required field {e} is missing in availability data.\")\n            raise KeyError(f\"Required field {e} is missing in availability data.\") from e\n        except TypeError as e:\n            logger.error(f\"Error in availability data: {e}\")\n            raise TypeError(f\"Error in availability data: {e}\") from e","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/job_application_profile.py#L110-L146","documentation":"TypeError from the work_preferences processing block: data['work_preferences'] is not unpackable as **kwargs (string, list, None → 'argument ... is not a mapping'), or WorkPreferences.__init__ rejects a key in the dict ('unexpected keyword argument'). The original TypeError text is carried in {e}, which distinguishes the two cases.","triggerScenarios":"work_preferences: true / work_preferences: [] in YAML; extra keys such as 'timezone' that WorkPreferences doesn't define; calling the constructor with positional args.","commonSituations":"Hand-written or LLM-generated YAML with wrong shape for the preferences section; library upgrades that renamed/removed WorkPreferences fields while old data files persist.","solutions":["Verify data['work_preferences'] is a dict; coerce scalars/lists or replace with {}.","Filter the dict to the exact keyword arguments WorkPreferences accepts.","Regenerate or migrate resume files against the current schema after library updates."],"exampleFix":"# before\nself.work_preferences = WorkPreferences(**data['work_preferences'])  # value is a list\n\n# after\nwp = data.get('work_preferences') or {}\nif not isinstance(wp, dict):\n    wp = {}\nself.work_preferences = WorkPreferences(**wp)","handlingStrategy":"type-guard","validationCode":"wp = data.get('work_preferences')\nif not isinstance(wp, dict):\n    data['work_preferences'] = {}","typeGuard":"def is_work_preferences_dict(data: dict) -> bool:\n    return isinstance(data.get('work_preferences'), dict)","tryCatchPattern":"try:\n    profile = JobApplicationProfile(**data)\nexcept TypeError as e:\n    if 'work_preferences' in str(e) and 'mapping' in str(e):\n        data['work_preferences'] = {}\n        profile = JobApplicationProfile(**data)","preventionTips":["Enforce dict shape for every object section at ingest","Reject/repair scalar sections early","Keep data schema and library versions in lockstep"],"tags":["python","typeerror","dict-unpacking","work-preferences"],"backgroundTag":"schema-validation-failed","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}