-
Notifications
You must be signed in to change notification settings - Fork 8.3k
fix: Handle read-only filesystem when updating starter project files #11163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: Handle read-only filesystem when updating starter project files #11163
Conversation
When running Langflow in containerized environments with readOnlyRootFilesystem: true, the update_project_file() function would fail when trying to write updated project data back to the package installation directory. This fix catches OSError and logs it as debug instead of failing, since the database is the source of truth for project data - file updates are optional convenience for development environments. Fixes langflow-ai#11145
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe change adds error handling to gracefully manage read-only filesystem scenarios when updating starter project files, catching OSError exceptions during file writes to prevent crashes in containerized environments with restricted filesystem permissions. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Pre-merge checks and finishing touchesImportant Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 2 warnings, 1 inconclusive)
✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…dling Added tests covering: - Normal write path (successful write to writable path) - Read-only filesystem handling (no exception raised) - Permission denied handling (graceful degradation) - Debug log verification on OSError
Summary
Fixes #11145 - Starter projects fail to load on Kubernetes when
readOnlyRootFilesystem: true.Problem
When deploying Langflow 1.7.1 on Kubernetes with security hardening (
readOnlyRootFilesystem: true), the application crashes during startup with:Failed to acquire lock for starter projects: [Errno 30] Read-only file system:
'/app/.venv/lib/python3.12/site-packages/langflow/initial_setup/starter_projects/Basic Prompt Chaining.json'
Root Cause Analysis
The error message is misleading - this is NOT a lock file issue. The actual problem:
tempfile.gettempdir()(line 212 inmain.py) - this is writableupdate_project_file()insetup.pytries to write updated project data back to JSON files in the package installation directorySolution
Wrap the file write operation in a try-except block that catches
OSErrorand logs it as debug instead of failing. The database is the source of truth for project data - file updates are optional convenience for development environments.