feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · ValueError

Section '{section_name}' not found in either resume or job_a

Error message

Section '{section_name}' not found in either resume or job_application_profile.

What it means

After a section name is extracted from the LLM reply, the code looks the section up with getattr on both the resume object and job_application_profile. If both lookups return None, the section genuinely does not exist in the user's data, and the ValueError is raised with the offending section name.

Source

Thrown at src/libs/llm_manager.py:596

            chain = chains.get(section_name)
            raw_output = chain.invoke(
                {
                    RESUME: self.resume,
                    JOB_DESCRIPTION: self.job_description,
                    COMPANY: self.job.company,
                }
            )
            output = self._clean_llm_output(raw_output)
            logger.debug(f"Cover letter generated: {output}")
            return output
        resume_section = getattr(self.resume, section_name, None) or getattr(
            self.job_application_profile, section_name, None
        )
        if resume_section is None:
            logger.error(
                f"Section '{section_name}' not found in either resume or job_application_profile."
            )
            raise ValueError(
                f"Section '{section_name}' not found in either resume or job_application_profile."
            )
        chain = chains.get(section_name)
        if chain is None:
            logger.error(f"Chain not defined for section '{section_name}'")
            raise ValueError(f"Chain not defined for section '{section_name}'")
        raw_output = chain.invoke(
            {RESUME_SECTION: resume_section, QUESTION: question}
        )
        output = self._clean_llm_output(raw_output)
        logger.debug(f"Question answered: {output}")
        return output

    def answer_question_numeric(
        self, question: str, default_experience: str = 3
    ) -> str:
        logger.debug(f"Answering numeric question: {question}")
        func_template = self._preprocess_template_string(

View on GitHub (pinned to 79155b52fa)

Solutions

  1. Add the missing section to your resume YAML / job_application_profile data so the lookup succeeds.
  2. Make the section lookup fall back to a sensible default (e.g. personal_info) instead of raising.
  3. If sections were renamed in a schema update, re-generate or migrate the resume/profile objects.

Example fix

# before
resume:  # no certifications key
# after
resume:
  certifications: "AWS Solutions Architect 2023"
Defensive patterns

Strategy: validation

Validate before calling

SECTION_FIELDS = {'personal_info','skills','education','experience_details','projects','availability','salary_expectations','certifications','languages','interests','cover_letter'}
missing = [s for s in SECTION_FIELDS if getattr(resume, s, None) is None and getattr(profile, s, None) is None]
# sections in `missing` will raise if the LLM picks them

Type guard

def has_section(resume, profile, name: str) -> bool:
    return getattr(resume, name, None) is not None or getattr(profile, name, None) is not None

Try / catch

try:
    ans = llm_manager.answer_question_textual_wide_range(q)
except ValueError as e:
    if 'not found in either resume' in str(e):
        ans = default_answer(q)  # fallback, e.g. skip the question
    else:
        raise

Prevention

When it happens

Trigger: The LLM classifies a question under a section (e.g. 'certifications') that is absent from both the resume YAML and the job application profile, so getattr(resume, 'certifications', None) and getattr(job_application_profile, ...) are both None.

Common situations: Sparse resumes missing optional sections, resume schema changes that renamed fields, or an LLM misclassification into a section the user never filled in.

Related errors


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