{"record":{"id":"dbdf70e13b553167","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"attribute-error-in-availability-processing","errorCode":null,"errorMessage":"Attribute error in availability processing.","messagePattern":"Attribute error in availability processing\\.","errorType":"validation","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/job_application_profile.py","lineNumber":149,"sourceCode":"            raise AttributeError(\"Attribute error in work_preferences processing.\") from e\n        except Exception as e:\n            logger.error(f\"An unexpected error occurred while processing work_preferences: {e}\")\n            raise RuntimeError(\"An unexpected error occurred while processing work_preferences.\") from e\n\n        # Process availability\n        try:\n            logger.debug(\"Processing availability\")\n            self.availability = Availability(**data['availability'])\n            logger.debug(f\"Availability processed: {self.availability}\")\n        except KeyError as e:\n            logger.error(f\"Required field {e} is missing in availability data.\")\n            raise KeyError(f\"Required field {e} is missing in availability data.\") from e\n        except TypeError as e:\n            logger.error(f\"Error in availability data: {e}\")\n            raise TypeError(f\"Error in availability data: {e}\") from e\n        except AttributeError as e:\n            logger.error(f\"Attribute error in availability processing: {e}\")\n            raise AttributeError(\"Attribute error in availability processing.\") from e\n        except Exception as e:\n            logger.error(f\"An unexpected error occurred while processing availability: {e}\")\n            raise RuntimeError(\"An unexpected error occurred while processing availability.\") from e\n\n        # Process salary_expectations\n        try:\n            logger.debug(\"Processing salary_expectations\")\n            self.salary_expectations = SalaryExpectations(**data['salary_expectations'])\n            logger.debug(f\"salary_expectations processed: {self.salary_expectations}\")\n        except KeyError as e:\n            logger.error(f\"Required field {e} is missing in salary_expectations data.\")\n            raise KeyError(f\"Required field {e} is missing in salary_expectations data.\") from e\n        except TypeError as e:\n            logger.error(f\"Error in salary_expectations data: {e}\")\n            raise TypeError(f\"Error in salary_expectations data: {e}\") from e\n        except AttributeError as e:\n            logger.error(f\"Attribute error in salary_expectations processing: {e}\")\n            raise AttributeError(\"Attribute error in salary_expectations processing.\") from e","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/job_application_profile.py#L131-L167","documentation":"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.","triggerScenarios":"Nested availability fields (e.g. a date or list of dates) being None/scalar where the constructor expects a mapping or object with attributes.","commonSituations":"Optional availability subsections set to null in YAML; inconsistent producers; partial refactors of the Availability model changing nested types.","solutions":["Inspect e.__cause__ / logs for the exact attribute involved.","Normalize None-valued nested availability fields to {} or suitable defaults before construction.","Make the Availability constructor tolerant of missing nested objects (defaulting to empty instances)."],"exampleFix":"# before\nav = data['availability']  # {'from': None}\nself.availability = Availability(**av)\n\n# after\nav = {k: (v if v is not None else '') for k, v in (data.get('availability') or {}).items()}\nself.availability = Availability(**av)","handlingStrategy":"validation","validationCode":"av = data.get('availability') or {}\nav = {k: (v if v is not None else '') for k, v in av.items()}","typeGuard":"def availability_fields_valid(av) -> bool:\n    return isinstance(av, dict) and all(v is not None for v in av.values())","tryCatchPattern":"try:\n    profile = JobApplicationProfile(**data)\nexcept AttributeError as e:\n    if 'availability' in str(e):\n        log.error('attr cause: %r', e.__cause__)","preventionTips":["Null-check nested availability fields before construction","Standardize availability data shape across sources"],"tags":["python","attributeerror","null-handling","availability"],"backgroundTag":"schema-validation-failed","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}