risingwavelabs/risingwave · warning · DmlError

table schema has changed, please try again later

Error message

table schema has changed, please try again later

What it means

DmlError::SchemaChanged indicates that a DML statement (INSERT/UPDATE/DELETE) was attempted against a table whose schema changed while the DML path was using a stale table descriptor/reader. The streaming executors hold cached schema snapshots; when the catalog version advances (e.g. a concurrent ALTER or MV refresh), the DML operation is aborted so the statement can be retried against the new schema.

Solutions

  1. Simply retry the DML statement — the message says 'please try again later'; it will be planned against the new schema.
  2. Serialize schema changes with write workloads: pause ingestion during ALTER statements.
  3. Upgrade the client/plan cache if the error repeats persistently after the change completes.

Example fix

// before
INSERT INTO t VALUES (1);  // fails during concurrent ALTER
// after
-- retry loop until schema change settles
while (!insert_ok) { sleep(1s); INSERT INTO t VALUES (1); }
Defensive patterns

Strategy: retry

Try / catch

for (let attempt = 0; attempt < 5; attempt++) {
  try { await insert(); return; }
  catch (e) {
    if (String(e).includes("table schema has changed")) { await sleep(1000); continue; }
    throw e;
  }
}

Prevention

When it happens

Trigger: An INSERT/UPDATE/DELETE is in flight while the target table's schema is altered (or its catalog version changes), so the front-end/DML executor detects a mismatch between its cached schema and the current one.

Common situations: Long-running write workloads concurrent with `ALTER TABLE` / schema-change migrations; CI scripts that deploy schema changes while a data-ingestion job writes; retry storms after online DDL.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/b25cf1cf55eac3d1. Report an issue: GitHub.

Appendix: source

Thrown at src/dml/src/error.rs:18

// Copyright 2024 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// The error type for DML operations.
#[derive(thiserror::Error, Debug)]
pub enum DmlError {
    #[error("table schema has changed, please try again later")]
    SchemaChanged,

    #[error(
        "DML is not permitted during cluster recovery (no available table reader in streaming executors)"
    )]
    NoReader,

    #[error("table reader closed")]
    ReaderClosed,
}

pub type Result<T> = std::result::Result<T, DmlError>;

View on GitHub (pinned to 6469eb736d)