{"record":{"id":"40e507f621681c3b","repo":"lfnovo/open-notebook","slug":"failed-to-submit-note-embedding-job","errorCode":null,"errorMessage":"Failed to submit note embedding job","messagePattern":"Failed to submit note embedding job","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/embedding.py","lineNumber":102,"sourceCode":"                source_item = await Source.get(item_id)\n\n                # Submit embed_source job (returns command_id for tracking)\n                command_id = await source_item.vectorize()\n                message = \"Source embedding job submitted\"\n\n            elif item_type == \"note\":\n                note_item = await Note.get(item_id)\n\n                # Note.save() internally submits embed_note command and\n                # returns command_id. Unlike Source.vectorize(), save()'s\n                # embed submission is best-effort (a hiccup there shouldn't\n                # fail an otherwise-successful note save) - but this\n                # endpoint's whole point is submitting the embedding job,\n                # so a submission failure here (content present, no\n                # command_id) must still surface as a failure.\n                command_id = await note_item.save()\n                if not command_id and note_item.content and note_item.content.strip():\n                    raise HTTPException(\n                        status_code=500, detail=\"Failed to submit note embedding job\"\n                    )\n                message = \"Note embedding job submitted\"\n\n            return EmbedResponse(\n                success=True,\n                message=message,\n                item_id=item_id,\n                item_type=item_type,\n                command_id=command_id,\n            )\n\n    except HTTPException:\n        raise\n    except NotFoundError:\n        raise HTTPException(\n            status_code=404, detail=f\"{embed_request.item_type} not found\"\n        )","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/embedding.py#L84-L120","documentation":"500 from POST /api/embed in the note path: note_item.save() returned a falsy command_id even though the note has non-empty content. Per the source comment, a missing command_id is tolerated when there is nothing to embed, but content-present + no command means the embedding job submission genuinely failed.","triggerScenarios":"POST /api/embed with item_type='note' where the note has content but save() returns None/empty — the internal submit_command() call failed without raising (e.g. queue unavailable but errors are swallowed by the convenience method).","commonSituations":"Worker/queue infrastructure misconfigured so command submission no-ops, or an API version where the note domain model's save path silently skips embedding submission under certain states.","solutions":["Check logs around the request for swallowed errors from note.save()/submit_command","Verify the worker and DB tiers are running (make worker-start, make status)","Re-save the note from the UI to re-trigger embedding once the stack is healthy","If it persists, inspect the note record state (empty vs populated content) and the domain model's save() return contract"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const note = await api.getNote(noteId);\nif (!note?.content?.trim()) throw new Error('Nothing to embed');","typeGuard":null,"tryCatchPattern":"try {\n  await api.embed({ item_id: noteId, item_type: 'note' });\n} catch (e) {\n  if (e.status === 500 && /note embedding job/i.test(e.detail)) {\n    await delay(2000); await api.embed({ item_id: noteId, item_type: 'note' }); // one retry after worker check\n  }\n  throw e;\n}","preventionTips":["Verify worker and DB health before note-embed flows","Re-save the note from the UI to re-trigger a silently dropped embedding job"],"tags":["embedding","note","job-queue","http-500"],"backgroundTag":"background-job-submission-failed","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}