{"record":{"id":"86ae0c5467de6972","repo":"lfnovo/open-notebook","slug":"error-embedding-content-str-e","errorCode":null,"errorMessage":"Error embedding content: {str(e)}","messagePattern":"Error embedding content: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/embedding.py","lineNumber":127,"sourceCode":"                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        )\n    except OpenNotebookError:\n        raise\n    except Exception as e:\n        logger.error(\n            f\"Error embedding {embed_request.item_type} {embed_request.item_id}: {str(e)}\"\n        )\n        raise HTTPException(\n            status_code=500, detail=f\"Error embedding content: {str(e)}\"\n        )\n","sourceCodeStart":109,"sourceCodeEnd":130,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/embedding.py#L109-L130","documentation":"Catch-all 500 from POST /api/embed for any unexpected failure during the embedding flow that isn't HTTP, NotFound, or OpenNotebookError. The underlying exception message is appended to the detail, so the response carries the specific cause.","triggerScenarios":"POST /api/embed when the embedding model provider call fails (invalid API key, network error), the item's content cannot be prepared for embedding, or the DB read of the item raises an unexpected error type.","commonSituations":"Embedding model credential expired/revoked, provider outage, oversized/empty content hitting an edge case, or DB connectivity problems mid-flow.","solutions":["Read the appended str(e) and the log line 'Error embedding <type> <id>: ...' for the exact cause","If it's a provider auth error, update the embedding model's credential API key in the Models/Credentials section","Verify network egress to the embedding provider from the API host","Retry after fixing the root cause; embedding is resubmittable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify the embedding model's credential works before embedding\nconst models = await api.listModels();\nconst emb = models.find(m => m.isDefault && m.type === 'embedding');\nif (!emb?.credentialId) throw new Error('Embedding model has no valid credential');","typeGuard":null,"tryCatchPattern":"try {\n  await api.embed(payload);\n} catch (e) {\n  if (e.status === 500) showError(`Embedding failed: ${e.detail}`); // detail carries the provider cause\n  throw e;\n}","preventionTips":["Keep embedding-model credentials valid; test keys after rotation","Surface the appended str(e) in the detail to users — it identifies provider vs DB causes"],"tags":["embedding","http-500","provider-api"],"backgroundTag":"provider-api-request-failed","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}