Skip to content

πŸ› Bug Report: Deleting a column under write load returns "table not found" to writersΒ #14336

Closed

Description

@JoshiJoshiJoshi

πŸ‘Ÿ Reproduction steps

  1. Table with an integer column k and a varchar column y with a default (PATCH …/columns/varchar/y with default: "d").
  2. Run 4 writers (createRow with only k) and 4 readers against both API nodes.
  3. Delete column y.

πŸ‘ Expected behavior

Writes keep succeeding (the column is gone or still there), or fail with a column error. The table is never reported as missing.

πŸ‘Ž Actual Behavior

In 3 of 3 rounds, 2–4 writes 20–90 ms after the delete return 404 table_not_found "Table with the requested ID 'p6_nf…' could not be found.", on both API nodes. Reads are not affected. Without a default on the deleted column: 0 errors in 4 rounds. When writers send the deleted column explicitly, the same 404 appears before the expected 400 Unknown attribute.

Cause: a writer that still has the cached table definition fills in the default for y. Postgres answers 42703 (undefined column), which utopia-php/database maps to NotFoundException('Attribute not found') (Adapter/Postgres.php L2218–L2220). Documents/Create.php L490–L491 turns every NotFoundException into "table not found". A client that reacts to a missing table (recreate, alert, stop syncing) is misled.

🎲 Appwrite version

2.4.0

πŸ’» Operating system

Linux (Debian 12), Docker

🧱 Your Environment

Self-hosted Appwrite 2.4.0, Postgres adapter, two API nodes behind no shared in-process cache.

πŸ’‘ Suggested fix

Map NotFoundException by its cause: "Attribute not found" β†’ 400 (column_not_found / retryable), only "Collection not found" β†’ table_not_found. Optionally retry once with a fresh table definition when Postgres reports 42703.

Related: #14335 (same catch block, Limit exceptions return 500).

πŸ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find a similar issue

🏒 Have you read the Code of Conduct?

  • I have read the Code of Conduct

Activity

  1. added
    product / databases
    product / sites
    product / vcs
    sdk / cli
    on Oct 11, 2026
  2. nk0273926 commented on Oct 12, 2026

    @nk0273926

    I’d like to work on this issue. The problem appears to be that a PostgreSQL 42703 (undefined column) error is mapped to NotFoundException, which is then incorrectly converted into 404 table_not_found in Documents/Create.php.

    I propose fixing the exception mapping so that a missing attribute returns an appropriate column/attribute error instead of incorrectly reporting that the table is missing. I’ll also look into adding a regression test for concurrent writes using a cached schema after a column with a default value is deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    product / databasesproduct / sitesproduct / vcssdk / cli

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions