feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · TypeError
Error in work_preferences data: {e}
Error message
Error in work_preferences data: {e} What it means
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.
Source
Thrown at src/resume_schemas/job_application_profile.py:128
raise TypeError(f"Error in legal_authorization data: {e}") from e
except AttributeError as e:
logger.error(f"Attribute error in legal_authorization processing: {e}")
raise AttributeError("Attribute error in legal_authorization processing.") from e
except Exception as e:
logger.error(f"An unexpected error occurred while processing legal_authorization: {e}")
raise RuntimeError("An unexpected error occurred while processing legal_authorization.") from e
# Process work_preferences
try:
logger.debug("Processing work_preferences")
self.work_preferences = WorkPreferences(**data['work_preferences'])
logger.debug(f"Work_preferences processed: {self.work_preferences}")
except KeyError as e:
logger.error(f"Required field {e} is missing in work_preferences data.")
raise KeyError(f"Required field {e} is missing in work_preferences data.") from e
except TypeError as e:
logger.error(f"Error in work_preferences data: {e}")
raise TypeError(f"Error in work_preferences data: {e}") from e
except AttributeError as e:
logger.error(f"Attribute error in work_preferences processing: {e}")
raise AttributeError("Attribute error in work_preferences processing.") from e
except Exception as e:
logger.error(f"An unexpected error occurred while processing work_preferences: {e}")
raise RuntimeError("An unexpected error occurred while processing work_preferences.") from e
# Process availability
try:
logger.debug("Processing availability")
self.availability = Availability(**data['availability'])
logger.debug(f"Availability processed: {self.availability}")
except KeyError as e:
logger.error(f"Required field {e} is missing in availability data.")
raise KeyError(f"Required field {e} is missing in availability data.") from e
except TypeError as e:
logger.error(f"Error in availability data: {e}")
raise TypeError(f"Error in availability data: {e}") from eView on GitHub (pinned to 79155b52fa)
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.
Example fix
# before
self.work_preferences = WorkPreferences(**data['work_preferences']) # value is a list
# after
wp = data.get('work_preferences') or {}
if not isinstance(wp, dict):
wp = {}
self.work_preferences = WorkPreferences(**wp) Defensive patterns
Strategy: type-guard
Validate before calling
wp = data.get('work_preferences')
if not isinstance(wp, dict):
data['work_preferences'] = {} Type guard
def is_work_preferences_dict(data: dict) -> bool:
return isinstance(data.get('work_preferences'), dict) Try / catch
try:
profile = JobApplicationProfile(**data)
except TypeError as e:
if 'work_preferences' in str(e) and 'mapping' in str(e):
data['work_preferences'] = {}
profile = JobApplicationProfile(**data) Prevention
- Enforce dict shape for every object section at ingest
- Reject/repair scalar sections early
- Keep data schema and library versions in lockstep
When it happens
Trigger: work_preferences: true / work_preferences: [] in YAML; extra keys such as 'timezone' that WorkPreferences doesn't define; calling the constructor with positional args.
Common situations: 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.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Error in legal_authorization data: {e}
- Error in availability data: {e}
- Error in salary_expectations data: {e}
- Required field {e} is missing in work_preferences data.
- Attribute error in work_preferences processing.
AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28).
Data as JSON: /api/errors/6d8aec789bdcc2eb.
Report an issue: GitHub.