lfnovo/open-notebook · error · ValueError
Failed to create insight - no ID in result
Error message
Failed to create insight - no ID in result
What it means
ValueError raised by create_insight_command when the insert result row exists but has no (or empty) 'id' field, so the command cannot obtain the new insight's ID to submit the follow-up embed_insight job. The str() conversion means even a missing key becomes '' and fails the check.
Source
Thrown at commands/embedding_commands.py:456
CREATE source_insight CONTENT {
"source": $source_id,
"insight_type": $insight_type,
"content": $content
};
""",
{
"source_id": ensure_record_id(input_data.source_id),
"insight_type": input_data.insight_type,
"content": input_data.content,
},
)
if not result or len(result) == 0:
raise ValueError("Failed to create insight - no result returned")
insight_id = str(result[0].get("id", ""))
if not insight_id:
raise ValueError("Failed to create insight - no ID in result")
# 2. Submit embedding command (fire-and-forget)
submit_command(
"open_notebook",
"embed_insight",
{"insight_id": insight_id},
)
logger.debug(f"Submitted embed_insight command for {insight_id}")
processing_time = time.time() - start_time
logger.info(
f"Successfully created insight {insight_id} for source "
f"{input_data.source_id} in {processing_time:.2f}s"
)
return CreateInsightOutput(
success=True,
insight_id=insight_id,View on GitHub (pinned to a7de90d38a)
Solutions
- Inspect the actual insert result shape in worker logs / by reproducing the insert in SurrealDB
- Pin or align the SurrealDB and surrealdb-driver versions with this project's requirements
- Ensure the insert query's RETURN clause includes the full record (with id)
Defensive patterns
Strategy: retry
Try / catch
result = await run_command('create_insight', payload)
out = result.output
if out.get('success'):
insight_id = out['result']['insight_id']
else:
insight_id = await fallback_create_insight_via_api(payload) # e.g. POST /insights REST route Prevention
- Pin SurrealDB and driver versions to those this release tested against
- Fall back to the REST insight-creation endpoint when the command path fails
- Report result-shape regressions with the actual returned dict for diagnosis
When it happens
Trigger: SurrealDB returning a result object whose 'id' key is absent or null — e.g. a projection/RETURN clause that omits id, or a driver deserialization difference that nests the id elsewhere.
Common situations: SurrealDB or driver version changes altering the returned record shape; a repo_insert query modified to return projected fields without id.
Related errors
- Failed to create insight - no result returned
- {label} '{record_id}' not found
- {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
AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27).
Data as JSON: /api/errors/37bb758d19308e61.
Report an issue: GitHub.