{"record":{"id":"942f17ec81e5a890","repo":"lfnovo/open-notebook","slug":"failed-to-queue-embedding-str-e","errorCode":null,"errorMessage":"Failed to queue embedding: {str(e)}","messagePattern":"Failed to queue embedding: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/embedding.py","lineNumber":71,"sourceCode":"                command_id = await CommandService.submit_command_job(\n                    \"open_notebook\",\n                    command_name,\n                    command_input,\n                )\n\n                logger.info(f\"Submitted async {command_name} command: {command_id}\")\n\n                return EmbedResponse(\n                    success=True,\n                    message=\"Embedding queued for background processing\",\n                    item_id=item_id,\n                    item_type=item_type,\n                    command_id=command_id,\n                )\n\n            except Exception as e:\n                logger.error(f\"Failed to submit async embedding command: {e}\")\n                raise HTTPException(\n                    status_code=500, detail=f\"Failed to queue embedding: {str(e)}\"\n                )\n\n        else:\n            # DOMAIN MODEL PATH: Submit job via domain model convenience methods\n            # These methods internally call submit_command() - still fire-and-forget\n            logger.info(f\"Using domain model path for {item_type} {item_id}\")\n\n            command_id = None\n\n            # Get the item and submit embedding job\n            if item_type == \"source\":\n                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","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/embedding.py#L53-L89","documentation":"500 from POST /api/embed in the async path: submitting the background embedding command to the job queue failed. The exception message from the command-submission layer is appended, so the detail string carries the underlying cause.","triggerScenarios":"POST /api/embed with async_processing=true when the command cannot be queued — e.g. the surreal-commands worker infrastructure is unavailable or command submission raises (serialization error, DB write to the job table failing).","commonSituations":"Worker tier not running (make worker-start skipped): jobs queue forever or submission fails depending on DB state; or SurrealDB down when writing the command record.","solutions":["Start the worker: make worker-start (podcasts, embeddings and source processing are async jobs that silently fail without it)","Read the appended str(e) in the 400/500 detail and the log line 'Failed to submit async embedding command' for the root cause","Verify SurrealDB health: make status; restart the DB then the API and worker","Retry the embed once the full stack (DB → API → worker) is running"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure worker is up before submitting async embeds\nconst status = await api.getWorkerStatus?.(); // or make status server-side\nif (!status?.workerRunning) throw new Error('Start the worker (make worker-start) before async embedding');","typeGuard":null,"tryCatchPattern":"try {\n  await api.embed({ item_id, item_type: 'source', async_processing: true });\n} catch (e) {\n  if (e.status === 500 && /queue embedding/i.test(e.detail)) showError('Queue unavailable — is the worker running?');\n  throw e;\n}","preventionTips":["Always run make worker-start in dev; async jobs silently fail without it","Parse the appended cause in the detail string to distinguish queue vs provider failures"],"tags":["embedding","async","job-queue","worker","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"}