redis/jedis · error · IllegalArgumentException

All required VectorField parameters are not set.

Error message

All required VectorField parameters are not set.

What it means

VectorField.Builder.build() validates that all mandatory parts of a RediSearch vector field were configured: fieldName, algorithm (e.g. FLAT or HNSW), and a non-empty attributes map (containing keys like TYPE, DIM, DISTANCE_METRIC). If any is missing, it throws IllegalArgumentException("All required VectorField parameters are not set.") instead of producing an invalid schema field.

Solutions

  1. Chain all required builder calls: fieldName, algorithm, and at least one attribute (TYPE, DIM, DISTANCE_METRIC) before build().
  2. Ensure DIM matches your embedding size and attributes map is populated from valid config before building.
  3. Validate the source configuration early and fail with a clear message if vector parameters are missing.

Example fix

// before
VectorField f = new VectorField.Builder("emb").build(); // throws
// after
Map<String, Object> attrs = new HashMap<>();
attrs.put("TYPE", "FLOAT32"); attrs.put("DIM", 768); attrs.put("DISTANCE_METRIC", "COSINE");
VectorField f = new VectorField.Builder("emb").algorithm(VectorField.VectorAlgorithm.HNSW).addAttributes(attrs).build();
Defensive patterns

Strategy: validation

Validate before calling

if (fieldName == null || algorithm == null || attrs == null || attrs.isEmpty()) {
  throw new IllegalStateException("Vector field requires fieldName, algorithm and non-empty attributes");
}
VectorField f = new VectorField.Builder(fieldName).algorithm(algorithm).addAttributes(attrs).build();

Type guard

boolean canBuildVectorField(String name, VectorField.VectorAlgorithm alg, Map<String,Object> attrs) {
  return name != null && !name.isEmpty() && alg != null && attrs != null && !attrs.isEmpty();
}

Try / catch

try {
  field = builder.build();
} catch (IllegalArgumentException e) {
  throw new IllegalStateException("Incomplete vector field configuration: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling build() on a VectorField.Builder where fieldName was never set, the algorithm (VectorField.VectorAlgorithm.FLAT/HNSW) was never set, or attributes were never set / set to an empty map.

Common situations: Programmatically building an FT.CREATE schema where the DIM or algorithm attribute is computed from config that is absent; copy-pasted builder code missing the .algorithm(...) or .addAttribute(...) chained calls; empty YAML/properties driving index creation.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08). Data as JSON: /api/errors/97526a10b8af2eee. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/redis/clients/jedis/search/schemafields/VectorField.java:214

    private FieldName fieldName;
    private VectorAlgorithm algorithm;
    private Map<String, Object> attributes;

    /**
     * Private constructor to enforce use of the static builder() method.
     */
    private Builder() {
    }

    /**
     * Builds and returns a new VectorField instance with the configured properties.
     *
     * @return a new VectorField instance
     * @throws IllegalArgumentException if required parameters (fieldName, algorithm, or attributes) are not set
     */
    public VectorField build() {
      if (fieldName == null || algorithm == null || attributes == null || attributes.isEmpty()) {
        throw new IllegalArgumentException("All required VectorField parameters are not set.");
      }
      return new VectorField(fieldName, algorithm, attributes);
    }

    /**
     * Sets the field name for the vector field.
     *
     * @param fieldName the name of the vector field in the index
     * @return this Builder instance for method chaining
     */
    public Builder fieldName(String fieldName) {
      this.fieldName = FieldName.of(fieldName);
      return this;
    }

    /**
     * Sets the field name using a FieldName object.
     *

View on GitHub (pinned to 6dac31d4c2)