feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · ValueError

Job application file path is not set. Please create the appl

Error message

Job application file path is not set. Please create the application directory first.

What it means

Raised by JobApplicationSaver.save_application_details when it is called before an application directory has been created. The saver stores the target directory in self.job_application_files_path; if that attribute is None there is nowhere to write job_application.json, so the method refuses to proceed. It is a setup/ordering error, not a data error.

Source

Thrown at src/job_application_saver.py:39

    # Function to create a directory for each job application
    def create_application_directory(self):
        job = self.job_application.job

        # Create a unique directory name using the application ID and company name
        dir_name = f"{job.id} - {job.company} {job.title}"
        dir_path = os.path.join(BASE_DIR, dir_name)

        # Create the directory if it doesn't exist
        os.makedirs(dir_path, exist_ok=True)
        self.job_application_files_path = dir_path
        return dir_path

    # Function to save the job application details as a JSON file
    def save_application_details(self):

        if self.job_application_files_path is None:
            raise ValueError(
                "Job application file path is not set. Please create the application directory first."
            )

        json_file_path = os.path.join(
            self.job_application_files_path, "job_application.json"
        )
        with open(json_file_path, "w") as json_file:
            json.dump(self.job_application.application, json_file, indent=4)

    # Function to save files like Resume and CV
    def save_file(self, dir_path, file_path, new_filename):
        if dir_path is None:
            raise ValueError("dir path cannot be None")

        # Copy the file to the application directory with a new name
        destination = os.path.join(dir_path, new_filename)
        shutil.copy(file_path, destination)

View on GitHub (pinned to 79155b52fa)

Solutions

  1. Call the directory creation method on the saver (the one that sets job_application_files_path and returns the path) before calling save()/save_application_details().
  2. Check the saver's flow: if directory creation can fail, catch that failure and abort instead of continuing to save.
  3. Assert self.job_application_files_path is not None before invoking save() to fail fast with a clearer message.

Example fix

// before
saver.save_application_details()
// after
if saver.job_application_files_path is None:
    saver.create_application_directory()  # sets job_application_files_path
saver.save_application_details()
Defensive patterns

Strategy: validation

Validate before calling

if saver.job_application_files_path is None:
    raise RuntimeError('Call create_application_directory() before saving')
saver.save_application_details()

Try / catch

try:
    saver.save_application_details()
except ValueError as e:
    if 'file path is not set' in str(e):
        saver.create_application_directory()
        saver.save_application_details()  # retry once initialized
    else:
        raise

Prevention

When it happens

Trigger: Calling save_application_details() (usually via save()) before ever calling the directory-creation method (e.g. create_application_directory / similar) that sets job_application_files_path. Also triggered if directory creation failed silently and left the path as None.

Common situations: Reordering the save workflow, skipping the create-directory step after refactoring, or a failed directory creation (permissions, invalid company/job name for the folder) that leaves the saver uninitialized.

Related errors


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