{"record":{"id":"6ff8c69c8f3b5018","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"you-must-choose-a-style-before-generating-the-pdf","errorCode":null,"errorMessage":"You must choose a style before generating the PDF.","messagePattern":"You must choose a style before generating the PDF\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/libs/resume_and_cover_builder/resume_facade.py","lineNumber":99,"sourceCode":"        self.job.company = self.llm_job_parser.extract_company_name()\n        self.job.description = self.llm_job_parser.extract_job_description()\n        self.job.location = self.llm_job_parser.extract_location()\n        self.job.link = job_url\n        logger.info(f\"Extracting job details from URL: {job_url}\")\n\n\n    def create_resume_pdf_job_tailored(self) -> tuple[bytes, str]:\n        \"\"\"\n        Create a resume PDF using the selected style and the given job description text.\n        Args:\n            job_url (str): The job URL to generate the hash for.\n            job_description_text (str): The job description text to include in the resume.\n        Returns:\n            tuple: A tuple containing the PDF content as bytes and the unique filename.\n        \"\"\"\n        style_path = self.style_manager.get_style_path()\n        if style_path is None:\n            raise ValueError(\"You must choose a style before generating the PDF.\")\n\n\n        html_resume = self.resume_generator.create_resume_job_description_text(style_path, self.job.description)\n\n        # Generate a unique name using the job URL hash\n        suggested_name = hashlib.md5(self.job.link.encode()).hexdigest()[:10]\n        \n        result = HTML_to_PDF(html_resume, self.driver)\n        self.driver.quit()\n        return result, suggested_name\n    \n    \n    \n    def create_resume_pdf(self) -> tuple[bytes, str]:\n        \"\"\"\n        Create a resume PDF using the selected style and the given job description text.\n        Args:\n            job_url (str): The job URL to generate the hash for.","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/libs/resume_and_cover_builder/resume_facade.py#L81-L117","documentation":"create_resume_pdf_job_tailored generates a job-tailored resume PDF and needs a CSS style file chosen via the style manager. If get_style_path() returns None (no style selected), generation cannot proceed and a ValueError is raised.","triggerScenarios":"Calling create_resume_pdf_job_tailored() on the ResumeFacade before selecting/setting a resume style through the style manager (set_style / select_style API).","commonSituations":"Building a new pipeline and forgetting the style-selection step, style files not found so the manager defaults to None, or UI flow where the user skipped style choice.","solutions":["Call the style manager's set/select method with a valid style (or style file path) before creating the PDF.","Verify the style actually exists (get_style_path() returns a path) before invoking the facade.","If styles load from a directory, ensure that directory is configured and populated."],"exampleFix":"# before\npdf = facade.create_resume_pdf_job_tailored()\n# after\nfacade.style_manager.set_style('classic')  # or select_style_by_path(...)\npdf = facade.create_resume_pdf_job_tailored()","handlingStrategy":"validation","validationCode":"if facade.style_manager.get_style_path() is None:\n    facade.style_manager.set_style('classic')\npdf = facade.create_resume_pdf_job_tailored()","typeGuard":"def style_chosen(facade) -> bool:\n    return facade.style_manager.get_style_path() is not None","tryCatchPattern":"try:\n    pdf = facade.create_resume_pdf_job_tailored()\nexcept ValueError as e:\n    if 'choose a style' in str(e):\n        facade.style_manager.set_style('classic')\n        pdf = facade.create_resume_pdf_job_tailored()\n    else:\n        raise","preventionTips":["Set a default style immediately after constructing the facade.","Verify the styles directory exists and contains the style files at startup."],"tags":["python","pdf","resume","style-not-selected"],"backgroundTag":"required-option-not-set","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}