payloadcms/payload · error · InvalidConfiguration

Column ${columnPath} for compound index on ${path} was not f

Error message

Column ${columnPath} for compound index on ${path} was not found in the ${getTableToUse().name} table.

What it means

Thrown during schema build when a compound index references a column path that does not exist in the resolved table (base table or, for localized fields, the locales table). The column path is derived by replacing dots with underscores; if the underlying field never produced a column, the index cannot be created.

Source

Thrown at packages/drizzle/src/schema/build.ts:313

        return table
      }

      for (const { path, pathHasLocalized } of index.fields) {
        if (someLocalized === null) {
          someLocalized = pathHasLocalized
        }

        if (someLocalized !== pathHasLocalized) {
          throw new InvalidConfiguration(
            `Compound indexes within localized and non localized fields are not supported in SQL. Expected ${path} to be ${someLocalized ? 'non' : ''} localized.`,
          )
        }

        const columnPath = path.replaceAll('.', '_')

        if (!getTableToUse().columns[columnPath]) {
          throw new InvalidConfiguration(
            `Column ${columnPath} for compound index on ${path} was not found in the ${getTableToUse().name} table.`,
          )
        }

        columns.push(columnPath)
      }

      if (someLocalized) {
        columns.push('_locale')
      }

      let name = columns.join('_')
      // truncate against the limit, buildIndexName will handle collisions
      if (name.length > 63) {
        name = 'compound_index'
      }

      const indexName = buildIndexName({ name, adapter })

View on GitHub (pinned to 00c58b35c0)

Solutions

  1. Verify the field path in the index exactly matches a generated column (use snake_case of the dotted path).
  2. Remove the index entry for any field that no longer exists or that does not produce a standalone column.
  3. If the field was renamed, update the index fields object to the new name and rebuild the schema.

Example fix

// before
index: [{ fields: { oldName: true } }] // oldName renamed to newName
// after
index: [{ fields: { newName: true } }]
Defensive patterns

Strategy: validation

Validate before calling

function assertIndexColumnsExist(indexFields, tableColumns) {
  for (const path of indexFields) {
    const col = path.replaceAll('.', '_')
    if (!tableColumns[col]) throw new Error(`Index references missing column ${col}`)
  }
}

Prevention

When it happens

Trigger: Declaring `index: [{ fields: { 'some.deep.path': true } }]` where the dotted path does not map to a generated column, or referencing a field name that was renamed, removed, or only present on a select/conditional sub-schema.

Common situations: Renaming a field but not its index entry; indexing a relationship/upload sub-field that does not become its own column; stale index config after a schema refactor.

Related errors


AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12). Data as JSON: /api/errors/2ebe12ad98a175b3. Report an issue: GitHub.