remix-run/remix · error · DataTableValidationError

Invalid value for column "' + column + '" in table "' + tabl

Error message

Invalid value for column "' + column + '" in table "' + tableName + '"

What it means

When a validator or hook reports issues and the first issue's path starts with a string segment, the library throws a DataTableValidationError that names the offending column specifically. This is the column-level variant of validation failure: the value for that column failed a beforeWrite/validate/afterRead check.

Source

Thrown at packages/data-table/src/lib/database/write-lifecycle.ts:414

    output[key] = (value as Record<string, unknown>)[key]
  }

  return output
}

function throwValidationIssues(
  tableName: string,
  issues: ReadonlyArray<ValidationIssue>,
  operation: TableLifecycleOperation,
  source?: LifecycleCallbackSource,
): never {
  let firstIssue = issues[0]
  let issuePath = firstIssue?.path
  let firstPathSegment = issuePath && issuePath.length > 0 ? issuePath[0] : undefined
  let column = typeof firstPathSegment === 'string' ? firstPathSegment : undefined

  if (column) {
    throw new DataTableValidationError(
      'Invalid value for column "' + column + '" in table "' + tableName + '"',
      issues,
      {
        metadata: {
          table: tableName,
          column,
          operation,
          ...(source ? { source } : {}),
        },
      },
    )
  }

  throw new DataTableValidationError('Invalid value for table "' + tableName + '"', issues, {
    metadata: {
      table: tableName,
      operation,
      ...(source ? { source } : {}),

View on GitHub (pinned to 9696913134)

Solutions

  1. Fix the underlying data so the column value passes validation
  2. If the constraint is wrong, adjust the validator/hook issue condition
  3. Surface the error's issues array to the user as form field errors
Defensive patterns

Strategy: try-catch

Type guard

function isColumnValidationError(error: unknown): error is DataTableValidationError {
  return error instanceof DataTableValidationError && /Invalid value for column/.test(error.message)
}

Try / catch

try {
  await table.create({ values })
} catch (error) {
  if (error instanceof DataTableValidationError && error.metadata?.column) {
    return json({ fieldErrors: { [error.metadata.column]: error.issues[0]?.message } }, { status: 400 })
  }
  throw error
}

Prevention

When it happens

Trigger: Returning { issues: [{ message: 'Invalid email', path: ['email'] }] } from a validator or beforeWrite hook; a read-time hook flagging a specific column of a loaded row.

Common situations: Standard field validation (bad email format, too-short password, out-of-range number); data drifting from constraints after an import; hooks enforcing invariants like 'status must be active'.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/088a9664b7a0e9bf. Report an issue: GitHub.