{"record":{"id":"4d2c997a154c661f","repo":"invoke-ai/InvokeAI","slug":"no-existing-parent-found-for-path","errorCode":null,"errorMessage":"No existing parent found for {path}","messagePattern":"No existing parent found for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"invokeai/app/services/image_moves/image_moves_default.py","lineNumber":882,"sourceCode":"        current = start.resolve()\n        while current != root and current.is_relative_to(root):\n            try:\n                current.rmdir()\n            except OSError:\n                return\n            current = current.parent\n\n    def _assert_same_filesystem(self, source: Path, destination: Path) -> None:\n        source_parent = source.parent\n        destination_parent = self._nearest_existing_parent(destination.parent)\n        if source_parent.stat().st_dev != destination_parent.stat().st_dev:\n            raise ValueError(f\"Cross-filesystem image move is not supported: {source} -> {destination}\")\n\n    def _nearest_existing_parent(self, path: Path) -> Path:\n        current = path\n        while not current.exists():\n            if current.parent == current:\n                raise FileNotFoundError(f\"No existing parent found for {path}\")\n            current = current.parent\n        return current\n\n    def _fsync_file(self, path: Path) -> None:\n        try:\n            with path.open(\"rb\") as file:\n                os.fsync(file.fileno())\n        except OSError as e:\n            self._logger.debug(\"Unable to fsync file: %s: %s\", path, e)\n\n    def _fsync_dir(self, path: Path) -> None:\n        try:\n            dir_fd = os.open(path, os.O_RDONLY)\n        except OSError as e:\n            self._logger.debug(\"Unable to open directory for fsync: %s: %s\", path, e)\n            return\n        try:\n            os.fsync(dir_fd)","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/image_moves/image_moves_default.py#L864-L900","documentation":"_nearest_existing_parent walks up a path's parents looking for an existing ancestor to stat for filesystem comparison. If it reaches the filesystem root (current.parent == current) without finding an existing directory, it raises FileNotFoundError('No existing parent found for {path}').","triggerScenarios":"_assert_same_filesystem called with a destination whose entire parent chain doesn't exist — only possible with a malformed path (e.g. an unresolvable/rooted relative path), since even '/' normally exists. Typically a bug in path construction or a mocked/broken filesystem in tests.","commonSituations":"Passing an empty or relative path fragment as destination; a destination string with a bad mount prefix; sandboxed test environments where root doesn't exist; typos producing paths like 'images/outputs' resolved from a nonexistent cwd.","solutions":["Ensure the destination path is absolute and its ancestors are valid on the host filesystem.","Create the destination parent directory (mkdir -p) or fix the configured output path before running preflight_moves.","Check for misconfigured environment variables or settings producing empty/relative paths (e.g. INVOKEAI_ROOT unset).","If the path is genuinely unreachable, it's a filesystem/OS-level issue — verify mounts and permissions."],"exampleFix":"// before\ndest = \"\" or \"outputs/x\"  # unresolvable relative/empty path\n// after\nfrom pathlib import Path\ndest = Path(invokeai_root) / \"images\" / \"new-sub\"\ndest.parent.mkdir(parents=True, exist_ok=True)","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef destination_is_resolvable(dest: Path) -> bool:\n    d = Path(dest).resolve()\n    return any(p.exists() for p in [d, *d.parents])","typeGuard":"def is_absolute_existing_rooted(path: Path) -> bool:\n    return path.is_absolute() and any(p.exists() for p in [path, *path.parents])","tryCatchPattern":"try:\n    service.preflight_moves(job_id)\nexcept FileNotFoundError as e:\n    if \"No existing parent found\" in str(e):\n        # fix the destination path config, create parents, re-run","preventionTips":["Always use absolute paths for image root/destination configuration","Ensure INVOKEAI_ROOT and output paths are set and non-empty","Create destination parents (mkdir -p) before preflight","Sanity-check configured paths resolve at app startup"],"tags":["filesystem","path","not-found","configuration"],"backgroundTag":"missing-parent-directory","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}