Keat
10/23/2020, 7:59 AM0.13.10
prefect server
, and I started to see this error for scheduled task and manually run tasks
[{'message': 'Foreign key violation.', 'locations': [{'line': 2, 'column': 5}], 'path': ['set_flow_run_states'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR', 'exception': {'message': 'Foreign key violation.'}}}]
It seems like it comes from the graphql side of things. But I couldn’t figure out why it randomly fails with that error. After a couple of manual restart sometimes it works. I tried to debug but since it happens at the very beginning of the flow, there’s not much that I can find out
When I register the flow I register it with the same core version, or at least I try tonicholas
Keat
10/23/2020, 1:51 PMcore
version, I ruled them out, for now.
Another one is I restarted my local agent and provide new env var to the agent. But I am not sure where/how to start debugging with just that error message from gqlnicholas
nicholas
Keat
10/23/2020, 2:13 PMnicholas
Keat
10/23/2020, 4:43 PMpostgres_1 | 2020-10-23 16:37:55.136 UTC [28323] ERROR: insert or update on table "flow_run" violates foreign key constraint "flow_run_agent_id_fkey"
postgres_1 | 2020-10-23 16:37:55.136 UTC [28323] DETAIL: Key (agent_id)=(fe47d130-3aa1-4fda-93c4-509c3f911497) is not present in table "agent".
postgres_1 | 2020-10-23 16:37:55.136 UTC [28323] STATEMENT: WITH "flow_run__mutation_result_alias" AS (UPDATE "public"."flow_run" SET "agent_id" = ($1)::uuid WHERE (('true') AND ((((("public"."flow_run"."id") = (($2)::uuid)) AND ('true')) AND ('true')) AND ('true'))) RETURNING * , CASE WHEN 'true' THEN NULL ELSE "hdb_catalog"."check_violation"('update check constraint failed') END ), "flow_run__all_columns_alias" AS (SELECT "id" , "tenant_id" , "created" , "flow_id" , "parameters" , "scheduled_start_time" , "auto_scheduled" , "heartbeat" , "start_time" , "end_time" , "version" , "state" , "state_timestamp" , "state_message" , "state_result" , "state_start_time" , "serialized_state" , "name" , "context" , "times_resurrected" , "updated" , "idempotency_key" , "agent_id" FROM "flow_run__mutation_result_alias" ) SELECT json_build_object('affected_rows', (SELECT COUNT(*) FROM "flow_run__all_columns_alias" ) )
Current agent_id is 4edb33ee-a064-4cc4-8c4b-212cef7962bd
.
So it could be me starting and stopping the agent via ctrl+c
and also from the UI
. When I query the agent table via the api, there’s only the current agent running but not the id
listed in this error.nicholas
nicholas
nicholas
Keat
10/23/2020, 4:49 PMnicholas