You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug Report: Mutex Lock Failed During Indexing on Intel Mac #68
We investigated using an external embedding provider (Ollama) as a workaround, but discovered the tool doesn't currently support custom API endpoints via environment variables.
Code Analysis
Looking at the embedding provider code in dist/embeddings/:
OpenAI Provider (openai.js) accepts an apiEndpoint parameter:
Created separate issue #70 to track the custom OpenAI-compatible API endpoint support (OPENAI_BASE_URL). This will allow using Ollama, LiteLLM, and other OpenAI-compatible providers instead of the official OpenAI API.\n\nThe mutex lock issue (#68) and the base URL support (#70) are separate concerns, so tracking them independently.
Hey @rothnic, thanks for the detailed analysis; you basically solved it.
The root cause is onnxruntime-node@1.21.0, which has a well-documented C++ mutex
destruction order bug on macOS tracked in microsoft/onnxruntime#24579, fixed in 1.24.x. @huggingface/transformers@3.8.1 (current stable) still pins 1.21.0 exactly.
To answer your first post questions directly:
No special system requirements needed for Intel Macs - the issue isn't the setup here.
Yes, exactly this. Intel vs Apple Silicon doesn't matter - both will have the same bug.
Isn't a memory or thread limit. The crash is in C++ static destructor ordering at
shutdown, not resource exhaustion. The 50% mark is coincidental.
Long-term (fix the threading issue): @huggingface/transformers v4 pre-release already brings onnxruntime-node@1.24.3 which fixes this. I've opened chore: upgrade @huggingface/transformers to v4 #72 to track the upgrade once v4 is stable.
Activity
rothnic commentedon Mar 10, 2026
Additional Analysis: Embedding Provider Issue
We investigated using an external embedding provider (Ollama) as a workaround, but discovered the tool doesn't currently support custom API endpoints via environment variables.
Code Analysis
Looking at the embedding provider code in
dist/embeddings/:openai.js) accepts anapiEndpointparameter:Environment Variables (
types.js) only support:EMBEDDING_PROVIDER(transformers|openai)EMBEDDING_MODELOPENAI_API_KEYMissing: No
OPENAI_BASE_URLor similar for custom endpointsWorkaround Attempted
We tried using Ollama (OpenAI-compatible API at
http://100.79.168.98:11434/v1):But the
apiEndpointparameter isn't read from environment variables, so it still tries to usehttps://api.openai.com/v1.Potential Fix
The fix would be in
dist/embeddings/types.js:Alternative: Native Ollama Support
We also noticed there's a placeholder for Ollama:
Native Ollama support would be ideal since it would allow using local embeddings without the mutex/threading issues on Intel Macs.
Summary
The mutex crash appears to be in the
@huggingface/transformerslibrary's native bindings on Intel Macs. Workarounds:OPENAI_BASE_URLenv var support to use external providersHappy to test any patches or provide more system info!
rothnic commentedon Mar 11, 2026
Created separate issue #70 to track the custom OpenAI-compatible API endpoint support (OPENAI_BASE_URL). This will allow using Ollama, LiteLLM, and other OpenAI-compatible providers instead of the official OpenAI API.\n\nThe mutex lock issue (#68) and the base URL support (#70) are separate concerns, so tracking them independently.
feat(embeddings): add native Ollama provider for local embeddings
PatrickSys commentedon Mar 12, 2026
Hey @rothnic, thanks for the detailed analysis; you basically solved it.
The root cause is onnxruntime-node@1.21.0, which has a well-documented C++ mutex
destruction order bug on macOS tracked in microsoft/onnxruntime#24579, fixed in 1.24.x. @huggingface/transformers@3.8.1 (current stable) still pins 1.21.0 exactly.
To answer your first post questions directly:
shutdown, not resource exhaustion. The 50% mark is coincidental.
On your three workarounds: