lfnovo/open-notebook · error · HTTPException
Error updating default prompt: {str(e)}
Error message
Error updating default prompt: {str(e)} What it means
Generic 500 from PUT /transformations/default-prompt when persisting the updated default prompt fails unexpectedly. Validation of the request body is done by Pydantic before the handler runs, so a 500 indicates a persistence or serialization failure when saving DefaultPrompts.
Source
Thrown at api/routers/transformations.py:180
"""Update the default transformation prompt."""
try:
default_prompts: DefaultPrompts = await DefaultPrompts.get_instance() # type: ignore[assignment]
default_prompts.transformation_instructions = (
prompt_update.transformation_instructions
)
await default_prompts.update()
return DefaultPromptResponse(
transformation_instructions=default_prompts.transformation_instructions
)
except HTTPException:
raise
except OpenNotebookError:
raise
except Exception as e:
logger.error(f"Error updating default prompt: {str(e)}")
raise HTTPException(
status_code=500, detail=f"Error updating default prompt: {str(e)}"
)
@router.get(
"/transformations/{transformation_id}", response_model=TransformationResponse
)
async def get_transformation(transformation_id: str):
"""Get a specific transformation by ID."""
try:
transformation = await Transformation.get(transformation_id)
if not transformation:
raise HTTPException(status_code=404, detail="Transformation not found")
return _transformation_response(transformation)
except HTTPException:
raise
except OpenNotebookError:View on GitHub (pinned to a7de90d38a)
Solutions
- Check API logs for the exact exception logged before the 500
- Verify SurrealDB connectivity and that GET /transformations/default-prompt also works
- Retry the PUT after confirming the database is healthy
- If persistent, inspect the default prompt record in SurrealDB for corruption
Defensive patterns
Strategy: retry
Validate before calling
current = await client.get('/transformations/default-prompt')
if current.status_code != 200:
raise RuntimeError('cannot read default prompt; DB likely unhealthy') Try / catch
resp = await client.put('/transformations/default-prompt', json=body)
if resp.status_code >= 500:
await asyncio.sleep(2)
resp = await client.put('/transformations/default-prompt', json=body)
resp.raise_for_status() Prevention
- Read before write — confirm GET works before PUT
- Keep request bodies within DefaultPromptUpdate's expected schema
- Ensure database availability during writes
When it happens
Trigger: PUT /api/transformations/default-prompt with a valid body while SurrealDB is down, the default-prompt record cannot be found/created, or the save raises a non-OpenNotebookError exception.
Common situations: Database connectivity loss between GET and PUT, write permission issues on SurrealDB, or schema drift after an upgrade.
Related errors
- Error fetching default prompt: {str(e)}
- Error fetching transformation: {str(e)}
- Error updating transformation: {str(e)}
- Error deleting transformation: {str(e)}
- Error fetching chat sessions: {str(e)}
AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27).
Data as JSON: /api/errors/2bd4b5c33fe562fa.
Report an issue: GitHub.