Dev.to
7/15/2026

When fastembed silently rotted my worker: anchor your caches, don't trust /tmp
Short summary
A worker crash traced to fastembed silently caching ONNX models in the Windows temp directory, which the OS periodically purges. The fix is to explicitly set a project-rooted cache_dir in config and pass it to TextEmbedding, ensuring the cache survives reboots and is shared between API and worker processes. The post includes concrete code changes for config, initialization, and gitignore.
- •fastembed defaults to OS temp dir for model cache, which Windows purges intermittently
- •Fix: anchor cache_dir to PROJECT_ROOT in config and pass to TextEmbedding
- •Shared cache between API and worker prevents duplicate downloads and crash recurrence
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



