feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · ValueError
Vectorstore not initialized. Run extract_job_description fir
Error message
Vectorstore not initialized. Run extract_job_description first.
What it means
LLMJobParser first ingests the job posting into a vector store (extract_job_description) and then answers extraction queries via similarity search in _retrieve_context. If extraction is attempted before ingestion, self.vectorstore is falsy and the guard raises.
Source
Thrown at src/libs/resume_and_cover_builder/llm/llm_job_parser.py:101
# Create the vectorstore using FAISS
try:
self.vectorstore = FAISS.from_documents(documents=all_splits, embedding=self.llm_embeddings)
logger.debug("Vectorstore successfully initialized.")
except Exception as e:
logger.error(f"Error during vectorstore creation: {e}")
raise
def _retrieve_context(self, query: str, top_k: int = 3) -> str:
"""
Retrieves the most relevant text fragments using the retriever.
Args:
query (str): The search query.
top_k (int): Number of fragments to retrieve.
Returns:
str: Concatenated text fragments.
"""
if not self.vectorstore:
raise ValueError("Vectorstore not initialized. Run extract_job_description first.")
retriever = self.vectorstore.as_retriever()
retrieved_docs = retriever.get_relevant_documents(query)[:top_k]
context = "\n\n".join(doc.page_content for doc in retrieved_docs)
logger.debug(f"Context retrieved for query '{query}': {context[:200]}...") # Log the first 200 characters
return context
def _extract_information(self, question: str, retrieval_query: str) -> str:
"""
Generic method to extract specific information using the retriever and LLM.
Args:
question (str): The question to ask the LLM for extraction.
retrieval_query (str): The query to use for retrieving relevant context.
Returns:
str: The extracted information.
"""
context = self._retrieve_context(retrieval_query)
View on GitHub (pinned to 79155b52fa)
Solutions
- Call extract_job_description(job_text) on the parser before any information-extraction call.
- Check parser.vectorstore is truthy before extracting; re-run ingestion if not.
- If ingestion can fail, propagate that error so extraction is never attempted on an un-ingested parser.
Example fix
# before
info = parser._extract_information('salary')
# after
parser.extract_job_description(job_text) # populates vectorstore
info = parser._extract_information('salary') Defensive patterns
Strategy: validation
Validate before calling
if not getattr(parser, 'vectorstore', None):
parser.extract_job_description(job_text)
info = parser._extract_information('salary') Type guard
def parser_ready(parser) -> bool:
return getattr(parser, 'vectorstore', None) is not None Try / catch
try:
info = parser._extract_information(query)
except ValueError as e:
if 'Vectorstore not initialized' in str(e):
parser.extract_job_description(job_text)
info = parser._extract_information(query)
else:
raise Prevention
- Make ingestion the mandatory first step of every parse job.
- Do not reuse a parser instance for a new job posting without re-running extract_job_description.
When it happens
Trigger: Calling _extract_information (or a public method that uses it) before calling extract_job_description on the same LLMJobParser instance, or when ingestion failed and left vectorstore unset/None.
Common situations: Reordering the parse pipeline, reusing a parser instance across jobs without re-ingesting, or ingestion errors (embedding API failure) that were caught upstream leaving the store empty.
Related errors
- Job application file path is not set. Please create the appl
- dir path cannot be None
- Unsupported model type: {llm_model_type}
- Could not extract section name from the response.
- Section '{section_name}' not found in either resume or job_a
AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28).
Data as JSON: /api/errors/a821faa274eb928c.
Report an issue: GitHub.