<#3845 [BUG] Duplicate Database Creation> Issue cr...
# flyte-github
c
#3845 [BUG] Duplicate Database Creation Issue created by Yicheng-Lu-llll on <!date^1688709556^{date_short}|2023-07-07T05:59:16Z> ### Describe the bug When first running:
Copy code
flytectl demo start --dev
# Under flyte repo
make compile
POD_NAMESPACE=flyte ./flyte start --config flyte-single-binary-local.yaml
The following errors may occurs. {"json":{"src":"start.go:63"},"level":"info","msg":"Running Database Migrations...","ts":"2023-07-07T051337Z"} {"json":{"src":"initialize.go:41"},"level":"warning","msg":"Database [flyte] does not exist, trying to create it now","ts":"2023-07-07T051337Z"} {"json":{"src":"database.go:123"},"level":"warning","msg":"Database [flyte] does not exist","ts":"2023-07-07T051337Z"} {"json":{"src":"database.go:136"},"level":"info","msg":"Creating database flyte","ts":"2023-07-07T051337Z"} {"json":{"src":"handle.go:59"},"level":"info","msg":"Creating Database flyte since it does not exist","ts":"2023-07-07T051337Z"} {"json":{"src":"initialize.go:54"},"level":"error","msg":"Failed to create DB flyte err ERROR: duplicate key value violates unique constraint \"pg_database_datname_index\" (SQLSTATE 23505)","ts":"2023-07-07T051337Z"} panic: ERROR: duplicate key value violates unique constraint "pg_database_datname_index" (SQLSTATE 23505) It seems that during initialization, the process attempts to create the flyte database twice. this isn't a big issue as it can be resolved by simply rerunning the command
POD_NAMESPACE=flyte ./flyte start --config flyte-single-binary-local.yaml
. It will not encounter the same issue on subsequent runs as the flyte database will already exist. ### Expected behavior No errors when first running
POD_NAMESPACE=flyte ./flyte start --config flyte-single-binary-local.yaml
. ### Additional context to reproduce No response ### Screenshots No response ### Are you sure this issue hasn't been raised already? • Yes ### Have you read the Code of Conduct? • Yes flyteorg/flyte