AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Preview Branch Migration Runner Corrupts Newlines To Literal 'N' Characters

Supabase preview branch migration runner replaces newline characters (\n) in SQL migration files with the literal character 'n', causing syntax errors during migration execution. This affects any migration with multi-line SQL statements.

highConfidence 75%SupabasePostgreSQLEdge Functions

Origin Analysis

The migration runner likely reads the SQL file by splitting it into lines and then incorrectly rejoins them using the string "n" instead of "\n" as the separator. This results in every original newline being replaced by a single literal 'n' character, corrupting the SQL before execution.
1. Create a migration file containing multi-line SQL (e.g., a CREATE TYPE ... AS ENUM with values on separate lines). 2. Push a branch that triggers a Supabase preview branch creation. 3. Observe the preview branch migration runner fails with a syntax error near 'n'. 4. Verify the migration file on disk has correct LF (0x0a) line endings via hex dump.

Fixing Code Block

Edge Case Audit

The fix assumes the migration runner does not intentionally modify line endings for other processing. If other parts of the runner depend on the previous (corrupted) line handling, removing it may alter behavior. Test thoroughly with Unix (LF), Windows (CRLF), and mixed line endings. Also test with large migration files and concurrent preview branch builds. Rollback: redeploy the previous version of the migration runner if unexpected regressions occur.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state