#4248·flyway

Flyway SQL parser fail to parse direct snowflake DROP AGENT statement

Author: ntcong1310Created Jun 19, 2026Updated Jul 2, 2026

We found what appears to be a Snowflake parser gap in Flyway.

Flyway correctly detects the target database as Snowflake, but a migration file containing a direct Snowflake DROP AGENT IF EXISTS ... statement fails during parsing at line 1, column

  1. The same logical operation succeeds when wrapped in EXECUTE IMMEDIATE, which suggests the SQL is valid in Snowflake and the failure is in Flyway's direct SQL parsing path rather than execution. Snowflake documentsDROP AGENT IF EXISTS' as valid syntax, and `EXECUTE IMMEDIATE' executes SQL strings dynamically. [1]

. Flyway version: `11.10.5'

. Database: `Snowflake 10.21'

. JDBC driver: `Snowflake 3.23.1'

Reproduction: Run flyway migrate command for a file content: DROP AGENT IF EXISTS DATABASE.SCHEMA.AGENT;

ERROR: ERROR: Unexpected error org. flywaydb. core. api. FlywayException: Unable to parse statement in ./R__00_001_DROP_AGENT.sql at line 1 col 1. Incomplete statement at line 1 col 1: DROP AGENT IF EXISTS DATABASE.SCHEMA.AGENT;

Temporary Workaround: EXECUTE IMMEDIATE 'DROP AGENT IF EXISTS DATABASE.SCHEMA.AGENT';

Additional notes: CREATE AGENT and other DROP statement works