Database location doesn't respect --base-directory
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 155
Description
### Custom Node Testing
- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)
### Expected Behavior
- move temp, user, input, custom_nodes, output, models, web, config directories from ComfyUI to f:\ComfyUI_workdirs
- python -s main.py --base-directory f:\comfyui_workdirs --disable-all-custom-nodes
- database at F:\ComfyUI_workdirs\user is initialized, no warning in console
### Actual Behavior
- If ComfyUI/user directory does not exist:
> Failed to initialize database. Please ensure you have installed the latest requirements. If the error persists, please report this as in future the database will be required: (sqlite3.OperationalError) unable to open database file
> (Background on this error at: https://sqlalche.me/e/20/e3q8)
- If ComfyUI/user does exist, database file is initialized there, not in the user directory specified by --base-directory
### Steps to Reproduce
- python -s main.py --base-directory f:\comfyui_workdirs --disable-all-custom-nodes
- If ComfyUI/user directory does not exist:
> Failed to initialize database. Please ensure you have installed the latest requirements. If the error persists, please report this as in future the database will be required: (sqlite3.OperationalError) unable to open database file
> (Background on this error at: https://sqlalche.me/e/20/e3q8)
- If ComfyUI/user does exist, database file is initialized there, not in the user directory specified by --base-directory
### Debug Logs
```powershell
Setting up Visual Studio environment...
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.14.9
** Copyright (c) 2025 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
Starting ComfyUI_raw...
[START] Security scan
[DONE] Security scan
** ComfyUI startup time: 2025-12-10 03:19:21.964
** Platform: Windows
** Python version: 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]
** Python executable: F:\ComfyUI_raw\.ComfyUI_raw\Scripts\python.exe
** ComfyUI Path: f:\ComfyUI_raw\ComfyUI
** ComfyUI Base Folder Path: f:\ComfyUI_raw\ComfyUI
** User directory: f:\comfyui_workdirs\user
** ComfyUI-Manager config path: f:\comfyui_workdirs\user\__manager\config.ini
** Log path: f:\comfyui_workdirs\user\comfyui.log
[PRE] ComfyUI-Manager
Checkpoint files will always be loaded safely.
Total VRAM 32607 MB, total RAM 130848 MB
pytorch version: 2.10.0.dev20251209+cu130
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 5090 : cudaMallocAsync
Using async weight offloading with 2 streams
Enabled pinned memory 58881.0
working around nvidia conv3d memory bug.
Using pytorch attention
Python version: 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]
ComfyUI version: 0.4.0
ComfyUI frontend version: 1.34.8
[Prompt Server] web root: F:\ComfyUI_raw\.ComfyUI_raw\Lib\site-packages\comfyui_frontend_package\static
[START] ComfyUI-Manager
[ComfyUI-Manager] network_mode: public
Total VRAM 32607 MB, total RAM 130848 MB
pytorch version: 2.10.0.dev20251209+cu130
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 5090 : cudaMallocAsync
Using async weight offloading with 2 streams
Enabled pinned memory 58881.0
Skipping loading of custom nodes
Failed to initialize database. Please ensure you have installed the latest requirements. If the error persists, please report this as in future the database will be required: (sqlite3.OperationalError) unable to open database file
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Starting server
To see the GUI go to: http://127.0.0.1:8188
```
### Other
_No response_
Contributor guide
Research direction
No source file or test is named. Start by reproducing the Windows command with --base-directory and trace database initialization and path resolution; done means the SQLite database is created under the configured user directory, including when that directory does not yet exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlalchemy, sqlite
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100