feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · KeyError
Required field {e} is missing in availability data.
Error message
Required field {e} is missing in availability data. What it means
KeyError from the availability section handler in JobApplicationProfile.__init__: raised when 'availability' is absent from the top-level data dict (data['availability'] indexing) or when the Availability constructor is missing a required key and its KeyError propagates. The interpolated {e} names the missing key.
Source
Thrown at src/resume_schemas/job_application_profile.py:143
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 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 eView on GitHub (pinned to 79155b52fa)
Solutions
- Add the missing key named in the message to the resume data.
- Default the section when optional: data.setdefault('availability', {}) prior to construction.
- Review Availability.__init__ for required fields and ensure the source data provides them.
Example fix
# before
self.availability = Availability(**data['availability'])
# after
av = data.get('availability') or {}
self.availability = Availability(**av) Defensive patterns
Strategy: validation
Validate before calling
data.setdefault('availability', {}) Type guard
def has_availability(data: dict) -> bool:
return isinstance(data.get('availability'), dict) Try / catch
try:
profile = JobApplicationProfile(**data)
except KeyError as e:
if 'availability' in str(e):
data.setdefault('availability', {})
profile = JobApplicationProfile(**data) Prevention
- Treat availability as optional and default it before construction
- Validate required nested fields per the schema
When it happens
Trigger: Constructing JobApplicationProfile with a resume dict lacking 'availability', or an availability mapping missing a required field such as 'notice_period'.
Common situations: Resume templates that omit availability; sections dropped by cleaning code; newer schema making previously optional availability fields mandatory.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- Required field {e} is missing in legal_authorization data.
- Required field {e} is missing in work_preferences data.
- Required field {e} is missing in salary_expectations data.
- Error in availability data: {e}
- Attribute error in availability processing.
AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28).
Data as JSON: /api/errors/75d4e69221666e91.
Report an issue: GitHub.