sqlite3.OperationalError: table [schemas] already exists
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 12.5k
- Forks
- 991
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 10
Description
i was trying to follow new schemas tutorial and keep getting this error with different commands
% llm schemas --full
Traceback (most recent call last):
File "/Users/max/.local/bin/llm", line 10, in <module>
sys.exit(cli())
~~~^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/click/core.py", line 1161, in __call__
return self.main(*args, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/click/core.py", line 1082, in main
rv = self.invoke(ctx)
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/click/core.py", line 1697, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/click/core.py", line 1697, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/llm/cli.py", line 1467, in schemas_list
migrate(db)
~~~~~~~^^^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/llm/migrations.py", line 14, in migrate
fn(db)
~~^^^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/llm/migrations.py", line 244, in m014_schemas
db["schemas"].create(
~~~~~~~~~~~~~~~~~~~~^
{
^
...<3 lines>...
pk="id",
^^^^^^^^
)
^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/sqlite_utils/db.py", line 1703, in create
self.db.create_table(
~~~~~~~~~~~~~~~~~~~~^
self.name,
^^^^^^^^^^
...<13 lines>...
strict=strict,
^^^^^^^^^^^^^^
)
^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/sqlite_utils/db.py", line 1084, in create_table
self.execute(sql)
~~~~~~~~~~~~^^^^^
File "/Users/max/.local/share/uv/tools/llm/lib/python3.13/site-packages/sqlite_utils/db.py", line 535, in execute
return self.conn.execute(sql)
~~~~~~~~~~~~~~~~~^^^^^
sqlite3.OperationalError: table [schemas] already exists
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with llm schemas --full, then read llm/cli.py at schemas_list and llm/migrations.py at migrate and m014_schemas. Check how the existing schemas table is handled during migration; done means the schemas command no longer fails when that table already exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- cli, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100