lfnovo/open-notebook · error · HTTPException
Failed to duplicate episode profile
Error message
Failed to duplicate episode profile
What it means
Generic 500 raised when duplicating an episode profile fails unexpectedly — typically constructing or saving the copy (e.g., name collision on '<name> - Copy').
Source
Thrown at api/routers/episode_profiles.py:276
transcript_llm=original.transcript_llm,
language=original.language,
default_briefing=original.default_briefing,
num_segments=original.num_segments,
max_tokens=original.max_tokens,
)
await duplicate.save()
return _profile_to_response(
duplicate, await _speaker_name_for(duplicate.speaker_config)
)
except HTTPException:
raise
except OpenNotebookError:
raise
except Exception as e:
logger.error(f"Failed to duplicate episode profile: {e}")
raise HTTPException(
status_code=500, detail="Failed to duplicate episode profile"
)
View on GitHub (pinned to a7de90d38a)
Solutions
- Check logs for the exact cause on 'Failed to duplicate episode profile'
- If a name collision, rename the existing copy first or edit after duplicating
- Verify DB health and retry
- Consider making duplicate names unique (append a counter) at the API level
Example fix
// before
duplicate = EpisodeProfile(name=f"{original.name} - Copy", ...)
// after (unique suffix)
import uuid
duplicate = EpisodeProfile(name=f"{original.name} - Copy {uuid.uuid4().hex[:4]}", ...) Defensive patterns
Strategy: try-catch
Validate before calling
copies = {p["name"] for p in (await client.get("/api/episode-profiles")).json()}
new_name = f"{source_name} - Copy"
n = 2
while new_name in copies:
new_name = f"{source_name} - Copy ({n})"; n += 1 Try / catch
try:
await client.post(f"/api/episode-profiles/{profile_id}/duplicate")
except httpx.HTTPStatusError as e:
if e.response.status_code >= 500:
# likely name collision on '<name> - Copy' — rename existing copy and retry
await rename_existing_copy(source_name)
await client.post(f"/api/episode-profiles/{profile_id}/duplicate")
raise Prevention
- Don't duplicate the same profile twice without renaming
- Rename duplicates to meaningful unique names
- Consider patching the API to generate unique copy names
When it happens
Trigger: POST duplicate where db.save() of the new record fails: unique-name conflict because '<name> - Copy' already exists, DB outage, or serialization of fields copied from the original.
Common situations: Duplicating the same profile twice (both copies get the identical ' - Copy' name); DB schema constraints; DB downtime.
Related errors
- Failed to create episode profile
- Failed to fetch episode profiles
- Failed to fetch episode profile
- Failed to update episode profile
- Failed to delete episode profile
AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27).
Data as JSON: /api/errors/a087459a0b8e3697.
Report an issue: GitHub.