weaviate/weaviate · error

nearIMU.targetVectors cannot provide more than 1 target vect

Error message

nearIMU.targetVectors cannot provide more than 1 target vector value

What it means

nearIMU's targetVectors array must hold at most one vector name; more than one makes the search target ambiguous. validateNearIMUFn enforces len(nearIMU.TargetVectors) > 1 as an error. Single-target is required because each near* clause resolves one similarity computation.

Source

Thrown at usecases/modulecomponents/arguments/nearImu/param.go:58

}

func validateNearIMUFn(param interface{}) error {
	nearIMU, ok := param.(*NearIMUParams)
	if !ok {
		return errors.New("'nearIMU' invalid parameter")
	}

	if len(nearIMU.IMU) == 0 {
		return errors.New("'nearIMU.imu' needs to be defined")
	}

	if nearIMU.Certainty != 0 && nearIMU.WithDistance {
		return errors.New(
			"nearIMU cannot provide both distance and certainty")
	}

	if len(nearIMU.TargetVectors) > 1 {
		return errors.New(
			"nearIMU.targetVectors cannot provide more than 1 target vector value")
	}

	return nil
}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Reduce targetVectors to a single name in the nearIMU clause
  2. Run one nearIMU query per target vector if multiple searches are needed
  3. Omit targetVectors to fall back to the default vector

Example fix

// before
nearIMU: { imu: "...", targetVectors: ["imu","motion"] }
// after
nearIMU: { imu: "...", targetVectors: ["imu"] }
Defensive patterns

Strategy: validation

Validate before calling

if (Array.isArray(args.nearIMU?.targetVectors) && args.nearIMU.targetVectors.length > 1) {
  throw new Error("nearIMU.targetVectors allows at most 1 entry");
}

Type guard

function hasSingleTarget(clause) {
  return !Array.isArray(clause.targetVectors) || clause.targetVectors.length <= 1;
}

Prevention

When it happens

Trigger: GraphQL nearIMU clause with targetVectors containing 2+ names, e.g. ["imu","motion"].

Common situations: Assuming near* targetVectors behaves like Explore/nearText multi-target searches; code generators emitting every configured vector; users copying nearText multi-vector examples.

Related errors


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