weaviate/weaviate · error

%sField must be a string

Error message

%sField must be a string

What it means

This error is thrown by validateFields when an entry in the configured %sFields array (e.g. imageFields/audioFields in a multimodal module config) is not a string. The module iterates over the JSON config array and asserts each element is a property-name string before accepting it.

Source

Thrown at usecases/modulecomponents/settings/base_class_multimodal_settings.go:199

	}

	return nil
}

func (s *BaseClassMultiModalSettings) validateFields(name string, fields any) (int, error) {
	fieldsArray, ok := fields.([]any)
	if !ok {
		return 0, fmt.Errorf("%sFields must be an array", name)
	}

	if len(fieldsArray) == 0 {
		return 0, fmt.Errorf("must contain at least one %s field name in %sFields", name, name)
	}

	for _, value := range fieldsArray {
		v, ok := value.(string)
		if !ok {
			return 0, fmt.Errorf("%sField must be a string", name)
		}
		if len(v) == 0 {
			return 0, fmt.Errorf("%sField values cannot be empty", name)
		}
	}

	return len(fieldsArray), nil
}

func (s *BaseClassMultiModalSettings) validateWeights(name string, count int) error {
	weights, ok := s.getWeights(name)
	if ok {
		if len(weights) != count {
			return fmt.Errorf("weights.%sFields does not equal number of %sFields", name, name)
		}
		_, err := s.getWeightsArray(weights)
		if err != nil {
			return err

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Change each element of the <name>Fields array to a plain string property name, e.g. "imageFields": ["image"] instead of [{"field":"image"}]
  2. Print/validate the JSON config before applying it (jq 'map(type)' to check element types)
  3. Check the specific module's documentation for the expected fields format

Example fix

// before
"moduleConfig": {"multi2vec-bind": {"imageFields": [{"field": "image"}]}}
// after
"moduleConfig": {"multi2vec-bind": {"imageFields": ["image"]}}
Defensive patterns

Strategy: validation

Validate before calling

const fields = cfg.imageFields || cfg.audioFields;
if (!Array.isArray(fields) || fields.some(v => typeof v !== 'string')) {
  throw new Error('each <name>Fields entry must be a string');
}

Type guard

const isStringArray = (a: unknown): a is string[] => Array.isArray(a) && a.every(v => typeof v === 'string');

Prevention

When it happens

Trigger: Setting multimodal module class config like {"moduleConfig":{"multi2vec-clip":{"imageFields":[{"field":"blob"}]}}} where elements are objects instead of strings, or mixing non-string values (numbers, null, nested arrays) into the fields array.

Common situations: Copying an older or wrong-module config example where fields were objects; generating config programmatically and serializing non-strings; hand-editing JSON and leaving a trailing object element.

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 weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/8363bdddd1496bef. Report an issue: GitHub.