invoke-ai/InvokeAI · error
Image move job not found: {job_id}
Error message
Image move job not found: {job_id} What it means
get_job looks up an image move job by id in image_subfolder_move_jobs; if no row matches, it raises ValueError('Image move job not found: {job_id}'). It signals the caller passed a job id that does not exist (or no longer exists) in the database.
Source
Thrown at invokeai/app/services/image_moves/image_moves_default.py:710
with self._db.transaction() as cursor:
cursor.execute(
"UPDATE image_subfolder_move_jobs SET state = 'error', error_message = ? WHERE id = ?;",
(message, job_id),
)
cursor.execute(
"UPDATE image_subfolder_move_items SET state = 'error', error_message = ? WHERE job_id = ?;",
(message, job_id),
)
def get_job(self, job_id: int) -> ImageMoveJob:
with self._db.transaction() as cursor:
cursor.execute(
"SELECT id, state, error_message FROM image_subfolder_move_jobs WHERE id = ?;",
(job_id,),
)
row = cursor.fetchone()
if row is None:
raise ValueError(f"Image move job not found: {job_id}")
return ImageMoveJob(
id=cast(int, row["id"]), state=cast(MoveJobState, row["state"]), error_message=row["error_message"]
)
def get_latest_job(self) -> ImageMoveJob | None:
with self._db.transaction() as cursor:
cursor.execute(
"""--sql
SELECT id, state, error_message
FROM image_subfolder_move_jobs
ORDER BY id DESC
LIMIT 1;
"""
)
row = cursor.fetchone()
if row is None:
return None
return ImageMoveJob(View on GitHub (pinned to 0b6a024f2f)
Solutions
- Call get_latest_job() to see whether any move job exists and use its id.
- Verify you are querying the same invokeai.db the job was created against (check the configured database path).
- List existing jobs with SELECT id, state FROM image_subfolder_move_jobs; and pick a valid id.
- Handle the ValueError in caller code when the job may legitimately not exist (e.g. after DB reset).
Example fix
// before
job = move_service.get_job(42) # ValueError if absent
// after
job = move_service.get_latest_job()
if job is None:
print("no move jobs recorded")
else:
job = move_service.get_job(job.id) Defensive patterns
Strategy: try-catch
Validate before calling
def job_exists(db_path: str, job_id: int) -> bool:
import sqlite3
con = sqlite3.connect(db_path)
row = con.execute("SELECT 1 FROM image_subfolder_move_jobs WHERE id=?", (job_id,)).fetchone()
return row is not None Type guard
def is_valid_job(job) -> bool:
return job is not None and isinstance(getattr(job, 'id', None), int) Try / catch
try:
job = service.get_job(job_id)
except ValueError as e:
if "Image move job not found" in str(e):
job = service.get_latest_job() # fall back to most recent Prevention
- Use get_latest_job() instead of guessing job ids
- Persist job ids only alongside the same DB instance they were created in
- List jobs via SQL before querying a specific id
- Expect not-found after DB resets/reinstalls
When it happens
Trigger: Calling get_job(job_id) with an id from another/older database, an id for a job that was deleted, a fabricated id (e.g. 0 or 1 on a fresh DB), or using a job id after the DB file was reset/recreated.
Common situations: Storing a job id across app reinstalls or DB migrations; querying a test DB while the id came from a dev DB; calling recovery APIs with an id hardcoded from a tutorial.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Image move job {job_id} has no items
- Image move job {job_id} failed commit validation
- Unknown image subfolder strategy: {strategy}
- ImageRecordNotFoundException
- User {user_id} not found
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/6ec8903766f702b2.
Report an issue: GitHub.