feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · RuntimeError
An unexpected error occurred while processing salary_expecta
Error message
An unexpected error occurred while processing salary_expectations.
What it means
Catch-all RuntimeError for the salary_expectations section — the last section processed before 'JobApplicationProfile initialization completed successfully' is logged. Any exception other than KeyError/TypeError/AttributeError raised while constructing SalaryExpectations is wrapped as this message, with the original chained. Because it aborts the very end of __init__, earlier sections were already set on the instance but the object is still not returned.
Source
Thrown at src/resume_schemas/job_application_profile.py:170
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"
f"Availability: {self.availability.notice_period}\n\n"
f"Salary Expectations: {self.salary_expectations.salary_range_usd}\n\n")
logger.debug(f"String representation generated: {formatted_str}")
return formatted_str
View on GitHub (pinned to 79155b52fa)
Solutions
- Read e.__cause__ to find the underlying exception and field.
- Isolate by constructing SalaryExpectations(**data['salary_expectations']) with the same payload.
- Sanitize the value (parse numbers, normalize currency codes) or add a targeted except clause for the real type.
Example fix
# before
except Exception as e:
raise RuntimeError("An unexpected error occurred while processing salary_expectations.") from e
# after
except ValueError as e:
raise ValueError(f"Invalid salary_expectations: {e}") from e
except Exception as e:
raise RuntimeError(f"Unexpected salary_expectations failure: {e!r}") from e Defensive patterns
Strategy: try-catch
Try / catch
try:
profile = JobApplicationProfile(**data)
except RuntimeError as e:
if 'salary_expectations' in str(e):
handle(e.__cause__) Prevention
- Sanitize salary strings ('80,000' -> 80000) before loading
- Pin library versions
- Log chained causes
When it happens
Trigger: Nested validators inside SalaryExpectations raising ValueError (e.g. unparseable currency code or numeric range), IndexError, or custom exceptions during **-construction.
Common situations: Salary stored as a formatted string ('$80,000') that fails numeric coercion; stricter validation after a library upgrade; heterogeneous data sources.
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
- An unexpected error occurred while processing self_identific
- An unexpected error occurred while processing legal_authoriz
- An unexpected error occurred while processing work_preferenc
- An unexpected error occurred while processing availability.
- Attribute error in self_identification processing.
AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28).
Data as JSON: /api/errors/b552e2c7fa1b4e5e.
Report an issue: GitHub.