lfnovo/open-notebook · error · HTTPException

Failed to fetch episode profile

Error message

Failed to fetch episode profile

What it means

Generic 500 raised when fetching a single episode profile fails unexpectedly (outside HTTPException/OpenNotebookError). The underlying exception is logged with the profile name.

Source

Thrown at api/routers/episode_profiles.py:119

    try:
        profile = await EpisodeProfile.get_by_name(profile_name)

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

        return _profile_to_response(
            profile, await _speaker_name_for(profile.speaker_config)
        )

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


class EpisodeProfileCreate(BaseModel):
    name: str = Field(..., description="Unique profile name")
    description: str = Field("", description="Profile description")
    speaker_config: str = Field(
        ...,
        description=(
            "speaker_profile record ID (a profile name is also accepted "
            "for backward compatibility)"
        ),
    )
    outline_llm: Optional[str] = Field(None, description="Model record ID for outline")
    transcript_llm: Optional[str] = Field(
        None, description="Model record ID for transcript"
    )

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Check the API log line 'Failed to fetch episode profile <name>' for the traceback
  2. Verify the profile's speaker_config references an existing SpeakerProfile
  3. Confirm DB health and retry
  4. Repair or clear dangling references on the profile record
Defensive patterns

Strategy: retry

Try / catch

try:
    return await client.get(f"/api/episode-profiles/{quote(name)}")
except httpx.HTTPStatusError as e:
    if e.response.status_code >= 500:
        await asyncio.sleep(1)
        return await client.get(f"/api/episode-profiles/{quote(name)}")
    raise

Prevention

When it happens

Trigger: DB connectivity failure during EpisodeProfile.get_by_name, or an exception while building the response (e.g., resolving the speaker name for profile.speaker_config fails).

Common situations: SurrealDB down or restarting; the profile references a dangling speaker_config that blows up during _speaker_name_for; schema changes after partial migration.

Related errors


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