When I try to start Orion, I get "sqlite3.OperationalError: table flow already exists" - how to troubleshoot this?

This issue indicates incompatible database migration. Here is how you can approach it.

Delete the database file

If you haven’t run any mission-critical work there, you can simply remove the sqlite database file and start orion. This way, Prefect will create a new database and will populate it with new tables from scratch:

rm ~/.prefect/orion.db
prefect orion start

Reset the database

If you can’t remove it, try resetting the database. This will have the same effect - it will drop and recreate all Orion database tables:

prefect orion database reset -y
prefect orion start

Manual migration

You can also manually upgrade/downgrade the database:

prefect orion database downgrade will downgrade the Orion database. You can pass -r to downgrade to a specific revision. You can add --dry-run flag to show what migrations would be made without applying them. This will emit SQL statements to stdout.

prefect orion database upgrade will upgrade the Orion database. You can pass -r to upgrade to a specific revision. You can add --dry-run flag to show what migrations would be made without applying them. This will emit SQL statements to stdout.

Try Prefect Cloud instead

If database migrations and server administration are not something you want to worry about, try Prefect Cloud: https://app.prefect.cloud/ - there is an always-free tier to help you get started.

Docs