ValueError: No such index: 'ix_tags_tag_type'
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
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
I cloned the latest code and when I ran it, I encountered this error.
python -u main.py --listen --port 8188 --enable-manager
### Actual Behavior
Create Date: 2025-12-10 00:00:00
[INFO] Running upgrade 0001_assets -> 0002_merge_to_asset_references, Merge AssetInfo and AssetCacheState into unified asset_references table.
[INFO] Running upgrade 0002_merge_to_asset_references -> 0003_add_metadata_job_id, Add system_metadata and job_id columns to asset_references.
Change preview_id FK from assets.id to asset_references.id.
[INFO] Running upgrade 0003_add_metadata_job_id -> 0004_drop_tag_type, Drop the vestigial tags.tag_type column.
[ERROR] Error upgrading database:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/alembic/operations/batch.py", line 715, in drop_index
del self.indexes[idx.name] # type: ignore[arg-type]
~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'ix_tags_tag_type'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/code/ComfyUI/app/database/db.py", line 170, in _init_file_db
command.upgrade(config, target_rev)
File "/usr/local/lib/python3.12/dist-packages/alembic/command.py", line 483, in upgrade
script.run_env()
File "/usr/local/lib/python3.12/dist-packages/alembic/script/base.py", line 545, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.12/dist-packages/alembic/util/pyfiles.py", line 116, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/alembic/util/pyfiles.py", line 136, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/code/ComfyUI/alembic_db/env.py", line 67, in
run_migrations_online()
File "/code/ComfyUI/alembic_db/env.py", line 61, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "/usr/local/lib/python3.12/dist-packages/alembic/runtime/environment.py", line 969, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python3.12/dist-packages/alembic/runtime/migration.py", line 626, in run_migrations
step.migration_fn(**kw)
File "/code/ComfyUI/alembic_db/versions/0004_drop_tag_type.py", line 24, in upgrade
with op.batch_alter_table("tags") as batch_op:
File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
next(self.gen)
File "/usr/local/lib/python3.12/dist-packages/alembic/operations/base.py", line 408, in batch_alter_table
impl.flush()
File "/usr/local/lib/python3.12/dist-packages/alembic/operations/batch.py", line 161, in flush
fn(*arg, **kw)
File "/usr/local/lib/python3.12/dist-packages/alembic/operations/batch.py", line 717, in drop_index
raise ValueError("No such index: '%s'" % idx.name)
ValueError: No such index: 'ix_tags_tag_type'
[ERROR] 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: No such index: 'ix_tags_tag_type'
### Steps to Reproduce
python -u main.py --listen --port 8188 --enable-manager
### Debug Logs
```powershell
python -u main.py --listen --port 8188 --enable-manager
```
### Other
_No response_
Contributor guide
Research direction
Start with alembic_db/versions/0004_drop_tag_type.py and inspect the tags-table migration at the failing drop_index operation. Reproduce with `python -u main.py --listen --port 8188 --enable-manager`, then verify the database initializes successfully for the reported schema state without the missing-index error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100