lfnovo/open-notebook · error · HTTPException
Failed to start rebuild operation: {str(e)}
Error message
Failed to start rebuild operation: {str(e)} What it means
Catch-all 500 from the rebuild-start endpoint (POST /api/embeddings/rebuild or similar in embedding_rebuild.py). Starting a vector rebuild submits a long-running command; any unexpected failure in setup (job submission, DB access, config resolution) aborts with this error, with the cause appended.
Source
Thrown at api/routers/embedding_rebuild.py:123
},
)
logger.info(f"Submitted rebuild command: {command_id}")
return RebuildResponse(
command_id=command_id,
total_items=total_estimate,
message=f"Rebuild operation started. Estimated {total_estimate} items to process.",
)
except HTTPException:
raise
except OpenNotebookError:
raise
except Exception as e:
logger.error(f"Failed to start rebuild: {e}")
logger.exception(e)
raise HTTPException(
status_code=500, detail=f"Failed to start rebuild operation: {str(e)}"
)
@router.get("/rebuild/{command_id}/status", response_model=RebuildStatusResponse)
async def get_rebuild_status(command_id: str):
"""
Get the status of a rebuild operation.
Returns:
- **status**: queued, running, completed, failed
- **progress**: processed count, total count, percentage
- **stats**: breakdown by type (sources, notes, insights, failed)
- **timestamps**: started_at, completed_at
"""
try:
# Get command status from surreal_commands
status = await get_command_status(command_id)View on GitHub (pinned to a7de90d38a)
Solutions
- Check API logs for the 'Failed to start rebuild: ...' line plus full traceback
- Ensure the whole stack is up in order: make database, make api, make worker-start
- Confirm a default embedding model is configured before rebuilding
- Retry the rebuild start once healthy; check rebuild status via GET /rebuild/{command_id}/status for the accepted job
Defensive patterns
Strategy: validation
Validate before calling
// pre-flight before rebuild: stack up + embedding model set
const models = await api.listModels();
if (!models.some(m => m.isDefault && m.type === 'embedding')) throw new Error('Set a default embedding model before rebuild');
// server-side: make database && make api && make worker-start all healthy Try / catch
try {
const { command_id } = await api.startRebuild();
await poll(`/rebuild/${command_id}/status`);
} catch (e) {
if (e.status === 500) showError('Could not start rebuild — is the worker running?');
throw e;
} Prevention
- Start the worker before triggering rebuilds; async jobs silently fail without it
- Check the API log traceback (logger.exception) when a rebuild start fails
- Track rebuild progress via the status endpoint instead of assuming success
When it happens
Trigger: Triggering a full embedding rebuild when command submission to the job queue fails or the DB is unreachable — e.g. worker tier or SurrealDB down, or an embedding model resolution error before the job starts.
Common situations: Running 'rebuild embeddings' before starting the worker (make worker-start), no default embedding model configured, or DB restart mid-submission. The endpoint logs the full traceback (logger.exception) alongside the error line.
Related errors
- Failed to queue embedding: {str(e)}
- Failed to submit note embedding job
- Error embedding content: {str(e)}
- Error fetching chat sessions: {str(e)}
- Error creating chat session: {str(e)}
AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27).
Data as JSON: /api/errors/6c11b6c7d2d79d9f.
Report an issue: GitHub.