weaviate/weaviate · error

cannot add property to a non-existing index for %s

Error message

cannot add property to a non-existing index for %s

What it means

Migrator.AddProperty looks up the Index for the given class in the DB before delegating to idx.addProperty. If no index exists for that class name (class never created, already dropped, or name mismatch), it returns this error instead of dereferencing a nil index. It indicates the schema operation raced with or followed an absent collection.

Source

Thrown at adapters/repos/db/migrator.go:572

// shardHasProperty reports whether prop's value index exists on this shard. Geo
// props get a property-specific index and no filterable bucket, so probing that
// bucket would report them missing forever.
func shardHasProperty(shard ShardLike, prop *models.Property) bool {
	if dt, _ := schema.AsPrimitive(prop.DataType); dt == schema.DataTypeGeoCoordinates {
		return shard.hasGeoIndexForProp(prop.Name)
	}
	return shard.Store().Bucket(helpers.BucketFromPropNameLSM(prop.Name)) != nil
}

func (m *Migrator) AddProperty(ctx context.Context, className string, prop ...*models.Property) error {
	indexID := indexID(schema.ClassName(className))

	m.classLocks.Lock(indexID)
	defer m.classLocks.Unlock(indexID)

	idx := m.db.GetIndex(schema.ClassName(className))
	if idx == nil {
		return errors.Errorf("cannot add property to a non-existing index for %s", className)
	}

	return idx.addProperty(ctx, prop...)
}

func (m *Migrator) UpdateProperty(ctx context.Context, className string, property *models.Property) error {
	indexID := indexID(schema.ClassName(className))

	m.classLocks.Lock(indexID)
	defer m.classLocks.Unlock(indexID)

	idx := m.db.GetIndex(schema.ClassName(className))
	if idx == nil {
		return errors.Errorf("cannot update property for a non-existing index for %s", className)
	}

	return idx.updateProperty(ctx, property)
}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Verify the class exists (GET /v1/schema/{className}) before adding the property; fix case-sensitive name mismatches.
  2. Re-create the class (with the property included in the schema) if it was deleted; adding properties requires an existing index.
  3. In a cluster, ensure schema replication has converged and the request hits a node with the class; retry after schema sync.

Example fix

// before
err := client.Schema().PropertyCreator().
    WithClassName("Article"). // class deleted or wrong casing
    WithProperty(prop).Do(ctx) // "cannot add property to a non-existing index for Article"
// after
cls, err := client.Schema().ClassGetter().WithClassName("Article").Do(ctx)
if err != nil || cls == nil {
    return client.Schema().ClassCreator().WithClass(&models.Class{
        Class: "Article", Properties: []*models.Property{prop},
    }).Do(ctx) // create class with the property instead of patching
}
return client.Schema().PropertyCreator().WithClassName("Article").WithProperty(prop).Do(ctx)
Defensive patterns

Strategy: try-catch

Validate before calling

class, err := client.Schema().ClassGetter().WithClassName("Article").Do(ctx)
if err != nil || class == nil {
    return fmt.Errorf("class Article does not exist; cannot add property")
}
// proceed with PropertyCreator

Type guard

func indexExists(db IndexGetter, className string) bool {
    return db.GetIndex(schema.ClassName(className)) != nil
}

Try / catch

err := addProperty(ctx, className, prop)
if err != nil {
    if strings.Contains(err.Error(), "non-existing index") {
        // recreate class including the property, or fix class name casing
        return recreateClassWithProperty(ctx, className, prop)
    }
    return err
}

Prevention

When it happens

Trigger: Calling the schema API to add a property to a class whose index is absent from this node: class was deleted concurrently, the class name is misspelled/incorrectly cased, or the node hasn't finished replicating schema creation in a cluster.

Common situations: Race between DELETE /schema/... and PATCH add-property; multi-tenant setups where the operation targets a class removed on another node; client-side class-name typos (Weaviate class names are case-sensitive).

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/748614fd20ce28c6. Report an issue: GitHub.