"REDACTED.log" someone is experiencing this and their table columsn are just 18. How can we help them fix this?
Assistant
Let me read the log file to understand the error.
Assistant
The error is clear: PostgreSQL error 54011 (too_many_columns) - the projects table has hit or is near PostgreSQL's hard limit of 1600 columns, and migration 20260120101402 (AddAutomationFieldsToProjects) is trying to add more columns to it, pushing it over the limit.
Let me look at that migration and the projects table to understand the scope.
Assistant
This is interesting. The Ecto schema only defines ~25 columns, but the user is hitting the 1600-column PostgreSQL limit. This means the issue is likely on the user's side, not in the Tuist schema itself. The user mentioned their table has only 18 columns, which makes this even more puzzling.
However, looking more carefully at the error - this is a self-hosted Tuist server instance. The PostgreSQL 1600-column limit is a hard limit, and with only ~25 columns it shouldn't be hit. Let me check if there's something else going on.
The most likely explanation: the user might be running into this because they're using a PostgreSQL instance where the projects table has accumulated columns from repeated failed/partial migrations, or they have a different table structure. But with only 18 columns, that can't be it either.
Actually, wait - error 54011 can also occur when the row size exceeds the maximum tuple size (roughly 8KB for the fixed portion), which depends on column types. But with only 18-25 columns of simple types, that shouldn't happen either.
Let me reconsider. The error message says "tables can have at most 1600 columns" literally. If the user says they only have 18 columns, this is very unusual. Let me check if there's a known PostgreSQL issue or if perhaps they're running a constrained PostgreSQL setup.
The key facts:
Migration 20260120101402 tries to add 6 columns to the projects table
Error: PostgreSQL 54011 (too_many_columns) - "tables can have at most 1600 columns"
User claims: their table only has 18 columns
The Tuist schema defines ~25 columns total for projects
This error with only 18 columns is very unusual. Here are the possible causes and fixes:
Most likely cause: The user may have dropped and recreated columns many times on the same table. PostgreSQL tracks column positions internally, and dropped columns still count toward internal limits in some edge cases. However, 1600 is a very high number to reach this way.
Alternative cause: This could be a PostgreSQL version or configuration issue. Some managed PostgreSQL providers or forks have lower column limits.
Here's what I'd suggest telling the user:
The error 54011 (too_many_columns) from PostgreSQL says the projects table would exceed the 1600-column limit when adding 6 new columns. Since you only have 18 visible columns, this is unusual. Here are things to check:
Check for hidden/dropped columns - PostgreSQL keeps track of dropped columns internally. Run:
sql
SELECT attnum, attname, attisdropped
FROM pg_attribute
WHERE attrelid = 'projects'::regclass
ORDER BY attnum;
This will show if there are many dropped (invisible) columns accumulating.
Check your PostgreSQL version - Some managed database providers or forks may have different limits:
sql
SELECT version();
If dropped columns are the problem, the fix is to recreate the table cleanly:
sql
-- This reclaims space from dropped columns
VACUUM FULL projects;
Or if VACUUM FULL doesn't resolve it (it doesn't always clear dropped column slots), you'd need to:
sql
CREATE TABLE projects_new (LIKE projects INCLUDING ALL);
INSERT INTO projects_new SELECT * FROM projects;
-- Then swap tables (with appropriate foreign key handling)
If using a managed database with lower limits, you'd need to upgrade to a plan or provider that supports the standard 1600-column limit.
The most common scenario for this error with few visible columns is accumulated dropped columns from many ALTER TABLE ... DROP COLUMN operations over time, or from repeated migration rollbacks and re-runs.