generated from cording12/next-fast-turbo
-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
All indexing operations fail with SQLAlchemy MissingGreenlet errors. This affects:
- Google Drive connector indexing
- ClickUp connector indexing
- Manual file uploads
Documents are parsed successfully (Docling completes, embeddings are generated) but fail when attempting to save to the database. This appears to be an async/await issue where database operations are being performed outside the greenlet context in Celery task workers.
Deployment Type
- SurfSense Cloud (hosted version)
- Self-hosted version
Steps to Reproduce
- Deploy using quick-start Docker command
- Go to 'Connectors' and configure Google Drive (or ClickUp, or go to Documents)
- Click 'Quick Index' on a connector, OR click 'Upload Documents' and upload a PDF
- Go to 'Logs' panel and see indexing task fail
- Check Docker logs:
docker logs surfsense --tail 100 - See MissingGreenlet error
Expected Behavior
Documents should be parsed, embedded, and saved to the database. They should appear in the Documents panel.
Actual Behavior
- Docling parsing completes successfully
- Embeddings are generated successfully
- Database save fails with MissingGreenlet error
- No documents appear in the Documents panel
- Subsequent requests show "connection is closed" errors
Screenshots/Videos
N/A - Error is in logs
Environment Information
- Browser: Chrome 131
- Operating System: macOS 15.2 (Apple Silicon M4 Max)
- SurfSense Version: latest Docker image (pulled Jan 20, 2026)
Additional Environment Details (for Self-hosted only)
- Python Version: 3.12 (per container)
- Node.js Version: (bundled in container)
- Database: PostgreSQL with pgvector (bundled in container)
- Deployment Method: Docker quick-start
Additional Context
This appears to be a classic SQLAlchemy async/await bug. Per SQLAlchemy docs, MissingGreenlet occurs when:
- Lazy loading is triggered outside an async context
- Session objects are accessed after the async context closes
expire_on_commit=Falseis not set on AsyncSession
The error originates in Celery task files:
document_tasks.py(line 240, 263)file_processors.py(line 1097)google_drive_indexer.py(line 60)
Possibly related to #491 and #268.
Logs/Error Messages
sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called; can't call await_only() here.
Was IO attempted in an unexpected place?
(Background on this error at: https://sqlalche.me/e/20/xd2s)
File "/app/backend/app/tasks/celery_tasks/document_tasks.py", line 240, in _process_file_upload
File "/app/backend/app/tasks/document_processors/file_processors.py", line 1097, in process_file_in_background
sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called; can't call await_only() here.
File "/app/backend/app/routes/search_source_connectors_routes.py", line 1656, in run_google_drive_indexing
File "/app/backend/app/tasks/connector_indexers/google_drive_indexer.py", line 60, in index_google_drive_files
sqlalchemy.exc.PendingRollbackError: This Session's transaction has been rolled back due to a previous exception during flush. Original exception was: greenlet_spawn has not been called
[2026-01-20 17:51:44,881: ERROR/MainProcess] Google Drive indexing completed with errors for connector 1: Folder 'Action Phase Group Support': greenlet_spawn has not been called; can't call await_only() here.
Checklist
- I have searched existing issues to ensure this is not a duplicate
- I have provided all the required information above
- I have added appropriate labels (bug, deployment type)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working