lfnovo/open-notebook · warning · ValueError
{label} '{record_id}' not found
Error message
{label} '{record_id}' not found What it means
ValueError raised by the shared _embed_markdown_record helper (used by embed_note and embed_insight commands) when the loader callable returns no record for the given record_id. It is a precondition check before any embedding work starts.
Source
Thrown at commands/embedding_commands.py:113
)
raise
async def _embed_markdown_record(
input_data: CommandInput,
*,
label: str,
record_id: str,
loader: Callable[[str], Awaitable[Any]],
) -> Tuple[Dict[str, Any], str]:
"""
Load a record, validate its content, embed it as markdown and UPSERT the
embedding back onto the record. Shared by embed_note and embed_insight.
"""
# 1. Load record
record = await loader(record_id)
if not record:
raise ValueError(f"{label} '{record_id}' not found")
if not record.content or not record.content.strip():
raise ValueError(f"{label} '{record_id}' has no content to embed")
# 2. Generate embedding (auto-chunks + mean pools if needed)
# Notes and insights are typically markdown content
cmd_id = get_command_id(input_data)
embedding = await generate_embedding(
record.content, content_type=ContentType.MARKDOWN, command_id=cmd_id
)
# 3. UPSERT embedding into the record
await repo_query(
"UPDATE $record_id SET embedding = $embedding",
{
"record_id": ensure_record_id(record_id),
"embedding": embedding,
},View on GitHub (pinned to a7de90d38a)
Solutions
- Verify the note/insight ID exists in SurrealDB before resubmitting
- Check the command's result payload — it will carry success=False with this message
- If the record was deleted, no embedding is needed; drop the job
- If the record should exist, check you are connected to the correct database
Defensive patterns
Strategy: validation
Validate before calling
note = await Note.get(note_id) # or Insight.get(insight_id)
if not note:
raise KeyError(f'{note_id} does not exist') Try / catch
result = await run_command('embed_note', {'note_id': nid})
if not result.output.get('success'):
msg = result.output.get('error', '')
if 'not found' in msg:
return # record gone; nothing to embed Prevention
- Verify the record exists before submitting embedding jobs
- Expect success=False (not raised exceptions) from embed commands
- Avoid submitting embed jobs for records pending deletion
When it happens
Trigger: Submitting the embed_note or embed_insight command with a note_id/insight_id that was deleted or never existed. Per the module's own note, the ValueError is caught by the command wrapper and returned as success=False rather than raising to the retry layer.
Common situations: Fire-and-forget embedding jobs racing with record deletion (create_insight_command submits embed_insight immediately), or replaying old command payloads after a DB reset.
Related errors
- {label} '{record_id}' has no content to embed
- Source '{input_data.source_id}' not found
- Source '{input_data.source_id}' has no text to embed
- No chunks created after splitting text
- Embedding count mismatch: got {len(embeddings)} embeddings f
AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27).
Data as JSON: /api/errors/4454f278e345b989.
Report an issue: GitHub.