feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · AttributeError

Attribute error in availability processing.

Error message

Attribute error in availability processing.

What it means

AttributeError from the availability block: attribute access (method call like .get/.items, or attribute of a nested object) on a mistyped value — commonly None or str — inside Availability construction. The handler replaces the informative message with this static one; the original is preserved as __cause__ and in the error log.

Source

Thrown at src/resume_schemas/job_application_profile.py:149

            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 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

View on GitHub (pinned to 79155b52fa)

Solutions

  1. Inspect e.__cause__ / logs for the exact attribute involved.
  2. Normalize None-valued nested availability fields to {} or suitable defaults before construction.
  3. Make the Availability constructor tolerant of missing nested objects (defaulting to empty instances).

Example fix

# before
av = data['availability']  # {'from': None}
self.availability = Availability(**av)

# after
av = {k: (v if v is not None else '') for k, v in (data.get('availability') or {}).items()}
self.availability = Availability(**av)
Defensive patterns

Strategy: validation

Validate before calling

av = data.get('availability') or {}
av = {k: (v if v is not None else '') for k, v in av.items()}

Type guard

def availability_fields_valid(av) -> bool:
    return isinstance(av, dict) and all(v is not None for v in av.values())

Try / catch

try:
    profile = JobApplicationProfile(**data)
except AttributeError as e:
    if 'availability' in str(e):
        log.error('attr cause: %r', e.__cause__)

Prevention

When it happens

Trigger: Nested availability fields (e.g. a date or list of dates) being None/scalar where the constructor expects a mapping or object with attributes.

Common situations: Optional availability subsections set to null in YAML; inconsistent producers; partial refactors of the Availability model changing nested types.

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


AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28). Data as JSON: /api/errors/dbdf70e13b553167. Report an issue: GitHub.