Skip to content

liam erd build fails with “syntax error at end of input” when parsing large structure.sql files #4000

@Said-MZ

Description

@Said-MZ

Self Checks

Version Type

CLI Version (npm package)

Version (only for Self Hosted)

0.7.22

Steps to reproduce

  • Run liam erd build --input db/structure.sql --format postgres --output-dir erd
  • Ensure the SQL file is large (tens of thousands of lines) with a long INSERT INTO schema_migrations section.
  • Observe the “syntax error at end of input” warning.

Expected Behavior

The parser should handle large files

Actual Behavior

When generating an ERD from a large Rails structure.sql, the CLI throws:
WARN: Error during parsing schema file: syntax error at end of input

After testing, it’s not an actual SQL syntax issue. The error happens because the structure.sql file (specifically the INSERT INTO schema_migrations VALUES (...) block at the end) is extremely long.
If I manually delete from any part ~700 lines from that block, the build completes successfully.

Additional Context

Environment:
OS: macOS (can add yours)
DB: PostgreSQL
liam version: 0.7.22
Node.js version: v22.19.0

Temporary Workaround:
Manually remove INSERT INTO schema_migrations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions