lfnovo/open-notebook · error · HTTPException

Failed to delete episode profile

Error message

Failed to delete episode profile

What it means

Generic 500 raised when deleting an episode profile fails unexpectedly during profile.delete() or response construction.

Source

Thrown at api/routers/episode_profiles.py:235

    try:
        profile = await EpisodeProfile.get(profile_id)

        if not profile:
            raise HTTPException(
                status_code=404, detail=f"Episode profile '{profile_id}' not found"
            )

        await profile.delete()

        return {"message": "Episode profile deleted successfully"}

    except HTTPException:
        raise
    except OpenNotebookError:
        raise
    except Exception as e:
        logger.error(f"Failed to delete episode profile: {e}")
        raise HTTPException(
            status_code=500, detail="Failed to delete episode profile"
        )


@router.post(
    "/episode-profiles/{profile_id}/duplicate", response_model=EpisodeProfileResponse
)
async def duplicate_episode_profile(profile_id: str):
    """Duplicate an episode profile"""
    try:
        original = await EpisodeProfile.get(profile_id)

        if not original:
            raise HTTPException(
                status_code=404, detail=f"Episode profile '{profile_id}' not found"
            )

        duplicate = EpisodeProfile(

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Check logs for the exact traceback on 'Failed to delete episode profile'
  2. Verify DB connectivity and permissions
  3. Retry the delete once the DB is stable
  4. If references block deletion, remove dependents first or adjust schema
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(2):
    resp = await client.delete(f"/api/episode-profiles/{profile_id}")
    if resp.status_code < 500 or resp.status_code == 404 or attempt:
        break
    await asyncio.sleep(1)

Prevention

When it happens

Trigger: DB outage or timeout during the delete; record referenced by other data causing a driver-level error; permissions failure on the SurrealDB table.

Common situations: SurrealDB restarting mid-request, concurrent write conflicts on the same record, restricted DB user lacking delete permission.

Related errors


AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27). Data as JSON: /api/errors/46f0a9d1a6bff3cd. Report an issue: GitHub.