ungoogled-software/ungoogled-chromium · error · FileNotFoundError
Could not find series file in existing destination: {destina
Error message
Could not find series file in existing destination: {destination / 'series'} What it means
merge_patches raises FileNotFoundError when prepend=True and the destination directory exists but has no `series` file. Prepending requires an existing series file to read current patch order so new patches can be placed before it; without it the merge cannot proceed.
Source
Thrown at utils/patches.py:169
"""Copy files from source to destination with relative paths from path_iter"""
for path in path_iter:
(destination / path).parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(str(source / path), str(destination / path))
def merge_patches(source_iter, destination, prepend=False):
"""
Merges GNU quilt-formatted patches directories from sources into destination
destination must not already exist, unless prepend is True. If prepend is True, then
the source patches will be prepended to the destination.
"""
series = []
known_paths = set()
if destination.exists():
if prepend:
if not (destination / 'series').exists():
raise FileNotFoundError(
f"Could not find series file in existing destination: {destination / 'series'}")
known_paths.update(generate_patches_from_series(destination))
else:
raise FileExistsError(f'destination already exists: {destination}')
for source_dir in source_iter:
patch_paths = tuple(generate_patches_from_series(source_dir))
patch_intersection = known_paths.intersection(patch_paths)
if patch_intersection:
raise FileExistsError(f'Patches from {source_dir} have conflicting paths '
f'with other sources: {patch_intersection}')
series.extend(patch_paths)
_copy_files(patch_paths, source_dir, destination)
if prepend and (destination / 'series').exists():
series.extend(generate_patches_from_series(destination))
with (destination / 'series').open('w') as series_file:
series_file.write('\n'.join(map(str, series)))
View on GitHub (pinned to f85e84a480)
Solutions
- Create the missing `destination/series` file (possibly empty) or populate it with the existing patch list
- Remove the empty/stale destination directory so merge_patches can create it fresh
- Pass prepend=False if you intended a fresh merge into a new directory
- Verify destination points at a directory produced by a prior merge_patches run
Example fix
# before merge_patches(sources, dest, prepend=True) # dest exists but has no series # after (dest / 'series').touch() # or delete stale dest merge_patches(sources, dest, prepend=True)
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
dest = Path(destination)
if dest.exists() and prepend and not (dest / 'series').exists():
(dest / 'series').touch() # or abort: raise SystemExit(f'{dest}/series missing') Type guard
def is_mergeable_destination(dest):
d = Path(dest)
return not d.exists() or (d / 'series').is_file() Try / catch
try:
merge_patches(sources, dest, prepend=True)
except FileNotFoundError as e:
logger.error('destination not usable for prepend: %s', e)
shutil.rmtree(dest)
merge_patches(sources, dest, prepend=True) Prevention
- Only prepend into destinations produced by a previous merge_patches run
- Never mkdir the destination manually before merging
- Recreate the destination from scratch after an aborted merge
When it happens
Trigger: Calling merge_patches (or merge_platform_patches) with prepend=True while `destination` exists as a directory but lacks a `series` file — e.g. an empty or partially-created destination directory.
Common situations: Destination created by a previous failed merge or `mkdir -p` without copying the series file; typo in destination path pointing at an existing but unrelated directory; interrupted first merge left an empty dir.
Related errors
- destination already exists: {destination}
- Patches from {source_dir} have conflicting paths with other
AI-assisted analysis of ungoogled-software/ungoogled-chromium@f85e84a480 (2026-08-29).
Data as JSON: /api/errors/ff9ec06d2c2d5079.
Report an issue: GitHub.