feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · TypeError
Error in salary_expectations data: {e}
Error message
Error in salary_expectations data: {e} What it means
TypeError from the salary_expectations processing: data['salary_expectations'] is not a dict (so ** unpacking raises 'not a mapping'), or the dict contains a key SalaryExpectations.__init__ does not accept ('unexpected keyword argument'). The {e} interpolation preserves the original TypeError message distinguishing the two.
Source
Thrown at src/resume_schemas/job_application_profile.py:164
raise TypeError(f"Error in availability data: {e}") from e
except AttributeError as e:
logger.error(f"Attribute error in availability processing: {e}")
raise AttributeError("Attribute error in availability processing.") from e
except Exception as e:
logger.error(f"An unexpected error occurred while processing availability: {e}")
raise RuntimeError("An unexpected error occurred while processing availability.") from e
# Process salary_expectations
try:
logger.debug("Processing salary_expectations")
self.salary_expectations = SalaryExpectations(**data['salary_expectations'])
logger.debug(f"salary_expectations processed: {self.salary_expectations}")
except KeyError as e:
logger.error(f"Required field {e} is missing in salary_expectations data.")
raise KeyError(f"Required field {e} is missing in salary_expectations data.") from e
except TypeError as e:
logger.error(f"Error in salary_expectations data: {e}")
raise TypeError(f"Error in salary_expectations data: {e}") from e
except AttributeError as e:
logger.error(f"Attribute error in salary_expectations processing: {e}")
raise AttributeError("Attribute error in salary_expectations processing.") from e
except Exception as e:
logger.error(f"An unexpected error occurred while processing salary_expectations: {e}")
raise RuntimeError("An unexpected error occurred while processing salary_expectations.") from e
logger.debug("JobApplicationProfile initialization completed successfully.")
def __str__(self):
logger.debug("Generating string representation of JobApplicationProfile")
def format_dataclass(obj):
return "\n".join(f"{field.name}: {getattr(obj, field.name)}" for field in obj.__dataclass_fields__.values())
formatted_str = (f"Self Identification:\n{format_dataclass(self.self_identification)}\n\n"
f"Legal Authorization:\n{format_dataclass(self.legal_authorization)}\n\n"
f"Work Preferences:\n{format_dataclass(self.work_preferences)}\n\n"View on GitHub (pinned to 79155b52fa)
Solutions
- Ensure the section is a dict with exactly the keys SalaryExpectations accepts.
- Convert scalar forms into the expected dict shape or use {} as default.
- Re-validate resume files against the current schema after library upgrades.
Example fix
# before
self.salary_expectations = SalaryExpectations(**data['salary_expectations']) # value: 80000
# after
se = data.get('salary_expectations') or {}
if not isinstance(se, dict):
se = {'amount': se, 'currency': 'USD'}
self.salary_expectations = SalaryExpectations(**se) Defensive patterns
Strategy: type-guard
Validate before calling
se = data.get('salary_expectations')
if not isinstance(se, dict):
data['salary_expectations'] = {} Type guard
def is_salary_expectations_dict(data: dict) -> bool:
return isinstance(data.get('salary_expectations'), dict) Try / catch
try:
profile = JobApplicationProfile(**data)
except TypeError as e:
if 'salary_expectations' in str(e):
data['salary_expectations'] = {}
profile = JobApplicationProfile(**data) Prevention
- Convert scalar salary values to the expected dict shape at ingest
- Filter keys to those the constructor accepts
When it happens
Trigger: salary_expectations: 80000 (a bare number) in YAML; a list of ranges; extra keys like 'negotiable: true' not present in the constructor signature.
Common situations: Hand-written resume YAML using scalar salary values; older data files against a newer schema; extra keys injected by upstream tooling.
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 work_preferences data: {e}
- Error in availability data: {e}
- Required field {e} is missing in salary_expectations data.
- Attribute error in salary_expectations processing.
AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28).
Data as JSON: /api/errors/365550f0d74c70ef.
Report an issue: GitHub.