feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · ValueError
You must choose a style before generating the PDF.
Error message
You must choose a style before generating the PDF.
What it means
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.
Source
Thrown at src/libs/resume_and_cover_builder/resume_facade.py:99
self.job.company = self.llm_job_parser.extract_company_name()
self.job.description = self.llm_job_parser.extract_job_description()
self.job.location = self.llm_job_parser.extract_location()
self.job.link = job_url
logger.info(f"Extracting job details from URL: {job_url}")
def create_resume_pdf_job_tailored(self) -> tuple[bytes, str]:
"""
Create a resume PDF using the selected style and the given job description text.
Args:
job_url (str): The job URL to generate the hash for.
job_description_text (str): The job description text to include in the resume.
Returns:
tuple: A tuple containing the PDF content as bytes and the unique filename.
"""
style_path = self.style_manager.get_style_path()
if style_path is None:
raise ValueError("You must choose a style before generating the PDF.")
html_resume = self.resume_generator.create_resume_job_description_text(style_path, self.job.description)
# Generate a unique name using the job URL hash
suggested_name = hashlib.md5(self.job.link.encode()).hexdigest()[:10]
result = HTML_to_PDF(html_resume, self.driver)
self.driver.quit()
return result, suggested_name
def create_resume_pdf(self) -> tuple[bytes, str]:
"""
Create a resume PDF using the selected style and the given job description text.
Args:
job_url (str): The job URL to generate the hash for.View on GitHub (pinned to 79155b52fa)
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.
Example fix
# before
pdf = facade.create_resume_pdf_job_tailored()
# after
facade.style_manager.set_style('classic') # or select_style_by_path(...)
pdf = facade.create_resume_pdf_job_tailored() Defensive patterns
Strategy: validation
Validate before calling
if facade.style_manager.get_style_path() is None:
facade.style_manager.set_style('classic')
pdf = facade.create_resume_pdf_job_tailored() Type guard
def style_chosen(facade) -> bool:
return facade.style_manager.get_style_path() is not None Try / catch
try:
pdf = facade.create_resume_pdf_job_tailored()
except ValueError as e:
if 'choose a style' in str(e):
facade.style_manager.set_style('classic')
pdf = facade.create_resume_pdf_job_tailored()
else:
raise Prevention
- Set a default style immediately after constructing the facade.
- Verify the styles directory exists and contains the style files at startup.
When it happens
Trigger: Calling create_resume_pdf_job_tailored() on the ResumeFacade before selecting/setting a resume style through the style manager (set_style / select_style API).
Common situations: 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.
Related errors
- Il file di stile non è stato trovato nel percorso: {style_pa
- Error parsing YAML file.
- Unexpected error while parsing YAML: {e}
- Il contenuto HTML deve essere una stringa non vuota.
- Job application file path is not set. Please create the appl
AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28).
Data as JSON: /api/errors/6ff8c69c8f3b5018.
Report an issue: GitHub.