{"record":{"id":"365550f0d74c70ef","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"error-in-salary-expectations-data-e","errorCode":null,"errorMessage":"Error in salary_expectations data: {e}","messagePattern":"Error in salary_expectations data: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/resume_schemas/job_application_profile.py","lineNumber":164,"sourceCode":"            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\n        except Exception as e:\n            logger.error(f\"An unexpected error occurred while processing salary_expectations: {e}\")\n            raise RuntimeError(\"An unexpected error occurred while processing salary_expectations.\") from e\n\n        logger.debug(\"JobApplicationProfile initialization completed successfully.\")\n\n    def __str__(self):\n        logger.debug(\"Generating string representation of JobApplicationProfile\")\n\n        def format_dataclass(obj):\n            return \"\\n\".join(f\"{field.name}: {getattr(obj, field.name)}\" for field in obj.__dataclass_fields__.values())\n\n        formatted_str = (f\"Self Identification:\\n{format_dataclass(self.self_identification)}\\n\\n\"\n                         f\"Legal Authorization:\\n{format_dataclass(self.legal_authorization)}\\n\\n\"\n                         f\"Work Preferences:\\n{format_dataclass(self.work_preferences)}\\n\\n\"","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/resume_schemas/job_application_profile.py#L146-L182","documentation":"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.","triggerScenarios":"salary_expectations: 80000 (a bare number) in YAML; a list of ranges; extra keys like 'negotiable: true' not present in the constructor signature.","commonSituations":"Hand-written resume YAML using scalar salary values; older data files against a newer schema; extra keys injected by upstream tooling.","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."],"exampleFix":"# before\nself.salary_expectations = SalaryExpectations(**data['salary_expectations'])  # value: 80000\n\n# after\nse = data.get('salary_expectations') or {}\nif not isinstance(se, dict):\n    se = {'amount': se, 'currency': 'USD'}\nself.salary_expectations = SalaryExpectations(**se)","handlingStrategy":"type-guard","validationCode":"se = data.get('salary_expectations')\nif not isinstance(se, dict):\n    data['salary_expectations'] = {}","typeGuard":"def is_salary_expectations_dict(data: dict) -> bool:\n    return isinstance(data.get('salary_expectations'), dict)","tryCatchPattern":"try:\n    profile = JobApplicationProfile(**data)\nexcept TypeError as e:\n    if 'salary_expectations' in str(e):\n        data['salary_expectations'] = {}\n        profile = JobApplicationProfile(**data)","preventionTips":["Convert scalar salary values to the expected dict shape at ingest","Filter keys to those the constructor accepts"],"tags":["python","typeerror","dict-unpacking","salary-expectations"],"backgroundTag":"schema-validation-failed","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}