remix-run/remix · error · Error

Unknown column "{key}" in option "{optionName}" for table "{

Error message

Unknown column "{key}" in option "{optionName}" for table "{getTableName(table)}"

What it means

Column-selector options (unique, indexes, etc.) only accept names of columns that exist on the table. This error is thrown when a selector references a column key not present in the columns definition.

Source

Thrown at packages/data-table/src/lib/table.ts:1147

  defaultValue: readonly string[],
): string[] {
  if (selector === undefined) {
    return [...defaultValue]
  }

  let keys = Array.isArray(selector) ? [...selector] : [selector]

  if (keys.length === 0) {
    throw new Error(
      'Option "' + optionName + '" for table "' + getTableName(table) + '" must not be empty',
    )
  }

  let columns = getTableColumns(table)

  for (let key of keys) {
    if (!Object.prototype.hasOwnProperty.call(columns, key)) {
      throw new Error(
        'Unknown column "' +
          key +
          '" in option "' +
          optionName +
          '" for table "' +
          getTableName(table) +
          '"',
      )
    }
  }

  return keys
}

function normalizeTimestampConfig(options: TimestampOptions | undefined): TimestampConfig | null {
  if (!options) {
    return null
  }

View on GitHub (pinned to 9696913134)

Solutions

  1. Use the exact column key from the table's columns definition
  2. Update the option after renaming a column
  3. Type the selector against the table's row keys to catch drift at compile time

Example fix

// before
createTable('users', cols, { unique: ['emailAddress'] })
// after
createTable('users', cols, { unique: ['email'] })
Defensive patterns

Strategy: validation

Validate before calling

for (const key of keys) {
  if (!(key in tableColumns)) throw new Error(`unknown column ${key}`)
}

Prevention

When it happens

Trigger: unique: ['email'] on a table where the column is defined as emailAddress; also selectors computed at runtime referencing removed columns.

Common situations: Renaming columns without updating constraint options, snake_case/camelCase drift, or copy-pasting options between tables.

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 remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/1efafdca102a7f31. Report an issue: GitHub.