affaan-m/ECC · error · ValueError
CapCut draft replacement is unsafe; choose a new name
Error message
CapCut draft replacement is unsafe; choose a new name
What it means
export_draft never permits replacing an existing CapCut draft. Passing overwrite=True (or allowing a draft name collision with replacement) aborts the export, because overwriting a CapCut draft directory can destroy user editing work. The error tells you to pick a fresh draft name.
Solutions
- Choose a new, unique draft `name` for the export (add a timestamp or version suffix)
- Set overwrite=False and ensure no draft with that name exists in the drafts folder
- Delete or rename the existing draft manually in CapCut if it is truly disposable, then re-export with a fresh name
- Make your script generate names like f"draft-{time.strftime('%Y%m%d-%H%M%S')}"
Example fix
// before
export_draft(files, name='my-edit', overwrite=True)
// after
export_draft(files, name=f"my-edit-{int(time.time())}", overwrite=False) Defensive patterns
Strategy: validation
Validate before calling
drafts_dir = Path(drafts)
assert not overwrite, 'export_draft never permits overwriting drafts'
assert not (drafts_dir / name).exists(), f'draft {name!r} already exists; pick a new name' Try / catch
try:
export_draft(files, name=name, overwrite=False)
except ValueError as e:
if 'unsafe' in str(e):
export_draft(files, name=f'{name}-{int(time.time())}', overwrite=False) Prevention
- Never pass overwrite=True; the library refuses it by design
- Generate unique draft names with timestamps or UUID suffixes
- Check the drafts folder for the name before exporting
- Clean up old drafts explicitly rather than relying on replacement
When it happens
Trigger: Calling export_draft with overwrite=True, or with a `name` that already exists in the target drafts folder while replacement would be required (create_draft uses allow_replace=False).
Common situations: Re-running an export script twice with the same draft name; scripting batch exports that reuse names; assuming overwrite=True would behave like ffmpeg's -y flag.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- At least one video is required
- Draft name must be a plain file name
- application bundle differs from its bound evidence
- AuraUntrusted
- cannot upload, file does not exist
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/816f00b49256276c.
Report an issue: GitHub.
Appendix: source
Thrown at skills/taste-application/scripts/tasteforge/media/capcut.py:57
raise ValueError("Invalid concat file entry")
files.append((path.parent / fields[1]).resolve())
return files
def export_draft(
files,
drafts,
name,
width=1920,
height=1080,
fps=30,
overwrite=False,
cc=None,
probe=duration_of,
):
geometry(width, height, fps)
if overwrite:
raise ValueError("CapCut draft replacement is unsafe; choose a new name")
if not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_. -]{0,99}", name) or name.endswith(
"."
):
raise ValueError("Draft name must be a plain file name")
if not files:
raise ValueError("At least one video is required")
prepared = []
for filename in files:
path = Path(filename).resolve(strict=True)
duration = probe(path)
if not math.isfinite(duration) or duration <= 0:
raise ValueError(f"Invalid media duration: {path.name}")
prepared.append((str(path), duration))
if cc is None:
import pycapcut as cc
folder = cc.DraftFolder(str(drafts))
script = folder.create_draft(name, width, height, fps=fps, allow_replace=False)
script.add_track(cc.TrackType.video)View on GitHub (pinned to 8321021c54)