-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
sqlite3.OperationalError: table _alembic_tmp_flow already exists during Langflow startup #2139
Comments
Hey @NeoVand! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's tackle this together! To resolve the error related to the temporary table (_alembic_tmp_flow) already existing in the SQLite database when attempting to run Langflow (version v1.0.0a50), you can modify the Alembic migration script to handle the existence of the temporary table. Here is an updated version of the def upgrade() -> None:
conn = op.get_bind()
inspector = Inspector.from_engine(conn) # type: ignore
# Check if the temporary table exists and drop it if it does
if inspector.has_table('_alembic_tmp_flow'):
op.execute('DROP TABLE _alembic_tmp_flow')
# ### commands auto generated by Alembic - please adjust! ###
indexes_names = [index["name"] for index in inspector.get_indexes("flow")]
constraints_names = [constraint["name"] for constraint in inspector.get_unique_constraints("flow")]
with op.batch_alter_table("flow", schema=None) as batch_op:
if "ix_flow_endpoint_name" in indexes_names:
batch_op.drop_index("ix_flow_endpoint_name")
batch_op.create_index(batch_op.f("ix_flow_endpoint_name"), ["endpoint_name"], unique=False)
if "unique_flow_endpoint_name" not in constraints_names:
batch_op.create_unique_constraint("unique_flow_endpoint_name", ["user_id", "endpoint_name"])
if "unique_flow_name" not in constraints_names:
batch_op.create_unique_constraint("unique_flow_name", ["user_id", "name"])
# ### end Alembic commands ### This modification ensures that if the temporary table |
you can delete langflow.db or langflow-pre.db |
Description:
When attempting to run Langflow (version v1.0.0a50), the application fails to start due to an error encountered during the database migration process. The specific error indicates that a temporary table (_alembic_tmp_flow) already exists in the SQLite database, causing a conflict and preventing the application from proceeding.
Steps to Reproduce:
Execute the command langflow run.
Observe the error during the startup process.
Expected Behavior:
Langflow should successfully run without encountering database migration errors.
Actual Behavior:
Langflow fails to start, logging the following error:
`~ % langflow run
Starting Langflow v1.0.0a50...
[06/11/24 11:59:19] ERROR 2024-06-11 11:59:19 - ERROR - main - main.py:59
(sqlite3.OperationalError) table
_alembic_tmp_flow already exists
[SQL:
CREATE TABLE _alembic_tmp_flow (
name VARCHAR NOT NULL,
description VARCHAR,
icon VARCHAR,
icon_bg_color VARCHAR,
is_component BOOLEAN,
updated_at DATETIME,
id CHAR(32) NOT NULL,
data JSON,
user_id CHAR(32),
folder_id CHAR(32),
endpoint_name VARCHAR,
PRIMARY KEY (id),
CONSTRAINT flow_folder_id_fkey
FOREIGN KEY(folder_id) REFERENCES folder
(id),
CONSTRAINT fk_flow_user_id_user
FOREIGN KEY(user_id) REFERENCES user
(id),
CONSTRAINT
unique_flow_endpoint_name UNIQUE
(user_id, endpoint_name),
CONSTRAINT unique_flow_name
UNIQUE (user_id, name),
UNIQUE (id)
)
[06/11/24 11:59:19] ERROR 2024-06-11 11:59:19 - ERROR - glogging.py:272
glogging - Worker (pid:1427) exited
with code 3
ERROR 2024-06-11 11:59:19 - ERROR - glogging.py:272
glogging - Shutting down: Master
ERROR 2024-06-11 11:59:19 - ERROR - glogging.py:272
glogging - Reason: Worker failed to
boot.
`
The text was updated successfully, but these errors were encountered: