{"record":{"id":"f82d08e9ca862de0","repo":"lfnovo/open-notebook","slug":"speaker-profile-value-not-found","errorCode":null,"errorMessage":"Speaker profile '{value}' not found","messagePattern":"Speaker profile '(.+?)' not found","errorType":"exception","errorClass":"InvalidInputError","httpStatus":null,"severity":"error","filePath":"api/routers/episode_profiles.py","lineNumber":71,"sourceCode":"        name=profile.name,\n        description=profile.description or \"\",\n        speaker_config=profile.speaker_config,\n        speaker_config_name=speaker_name,\n        outline_llm=profile.outline_llm,\n        transcript_llm=profile.transcript_llm,\n        language=profile.language,\n        default_briefing=profile.default_briefing,\n        num_segments=profile.num_segments,\n        max_tokens=profile.max_tokens,\n    )\n\n\nasync def _resolve_speaker_config(value: str) -> SpeakerProfile:\n    \"\"\"Resolve an incoming speaker_config (record ID, or name for backward\n    compatibility) to the referenced SpeakerProfile.\"\"\"\n    speaker = await SpeakerProfile.resolve(value)\n    if not speaker:\n        raise InvalidInputError(f\"Speaker profile '{value}' not found\")\n    return speaker\n\n\n@router.get(\"/episode-profiles\", response_model=List[EpisodeProfileResponse])\nasync def list_episode_profiles():\n    \"\"\"List all available episode profiles\"\"\"\n    try:\n        profiles = await EpisodeProfile.get_all(order_by=\"name asc\")\n        speaker_names = await _speaker_names_by_id()\n        return [\n            _profile_to_response(\n                p, speaker_names.get(p.speaker_config) if p.speaker_config else None\n            )\n            for p in profiles\n        ]\n    except HTTPException:\n        raise\n    except OpenNotebookError:","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/episode_profiles.py#L53-L89","documentation":"InvalidInputError (mapped to HTTP 400) raised when creating/updating an episode profile and the provided speaker_config cannot be resolved to a SpeakerProfile record — it is neither a valid record ID nor a known profile name.","triggerScenarios":"POST or PUT /api/episode-profiles with speaker_config set to a deleted SpeakerProfile id, a misspelled name, or an id from a different environment/database.","commonSituations":"Speaker profile deleted after the frontend cached its name; copying request bodies between environments; using a display name when the record was stored under a different name after SpeakerProfile.resolve semantics changed.","solutions":["GET /api/speaker-profiles to list valid ids/names and use one of them","If resolving by name, ensure the name matches exactly (case/whitespace)","If the speaker profile was deleted, recreate it or clear speaker_config","Prefer the record ID over the name for stability"],"exampleFix":"// before\n{\"name\": \"podcast\", \"speaker_config\": \"Default Speaker\"}\n// after\n{\"name\": \"podcast\", \"speaker_config\": \"speaker_profile:abc123\"}","handlingStrategy":"validation","validationCode":"profiles = (await client.get(\"/api/speaker-profiles\")).json()\nvalid = {p[\"id\"] for p in profiles} | {p[\"name\"] for p in profiles}\nif payload.get(\"speaker_config\") not in valid:\n    payload[\"speaker_config\"] = profiles[0][\"id\"]  # or prompt the user","typeGuard":"def is_valid_speaker_ref(value: str, profiles: list[dict]) -> bool:\n    return value in {p[\"id\"] for p in profiles} | {p[\"name\"] for p in profiles}","tryCatchPattern":"try:\n    await create_episode_profile(payload)\nexcept HTTPError as e:\n    if e.response.status_code == 400 and \"not found\" in e.response.text:\n        # refresh speaker list and re-submit with a valid id\n        ...","preventionTips":["Reference speaker profiles by record id, not display name","Refresh the speaker-profile list before showing profile forms","Handle deletion of speaker profiles by cleaning up episode profiles that reference them"],"tags":["http-400","invalid-input","speaker-profile","episode-profile"],"backgroundTag":"invalid-input-reference","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}