lfnovo/open-notebook · error · HTTPException
Failed to delete episode
Error message
Failed to delete episode
What it means
Generic 500 from the delete-podcast-episode endpoint when an unexpected exception occurs while deleting an episode. The true cause is only in the server log ('Error deleting podcast episode: ...').
Source
Thrown at api/routers/podcasts.py:430
# Get the episode first to check if it exists and get the audio file path
episode = await PodcastService.get_episode(episode_id)
# Delete the physical audio file if it exists
_delete_episode_audio(episode, episode_id)
# Delete the episode from the database
await episode.delete()
logger.info(f"Deleted podcast episode: {episode_id}")
return {"message": "Episode deleted successfully", "episode_id": episode_id}
except HTTPException:
raise
except OpenNotebookError:
raise
except Exception as e:
logger.error(f"Error deleting podcast episode: {str(e)}")
raise HTTPException(
status_code=500, detail="Failed to delete episode"
)
View on GitHub (pinned to a7de90d38a)
Solutions
- Check server logs for the underlying exception string
- Verify the episode_id exists via GET before deleting
- Ensure SurrealDB is running and migrations completed on API startup
- Remove dependent records (notes, jobs) or rely on cascade if implemented
Defensive patterns
Strategy: try-catch
Validate before calling
const res = await fetch(`/api/podcasts/episodes/${id}`);
if (res.status === 404) { /* nothing to delete */ } Try / catch
try {
await api.delete(`/podcasts/episodes/${id}`);
} catch (e) {
if (e.status === 500) refreshListAndCheckServerLogs();
} Prevention
- Guard against double-deletes from stale UI state
- Confirm DB connectivity before bulk deletes
- Handle 404 as success (already deleted)
When it happens
Trigger: DELETE /api/podcasts/episodes/{episode_id} when the delete touches missing records, fails a DB transaction, or the episode has orphaned related rows that break deletion logic.
Common situations: Deleting an already-deleted episode concurrently, SurrealDB down or schema drift after migration, foreign references (notes, jobs) pointing at the episode.
Related errors
- Error deleting session: {str(e)}
- Failed to list credentials
- Failed to update credential
- Failed to delete credential
- Failed to fetch episode profiles
AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27).
Data as JSON: /api/errors/5356386a77e22892.
Report an issue: GitHub.