{"record":{"id":"97526a10b8af2eee","repo":"redis/jedis","slug":"all-required-vectorfield-parameters-are-not-set","errorCode":null,"errorMessage":"All required VectorField parameters are not set.","messagePattern":"All required VectorField parameters are not set\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/search/schemafields/VectorField.java","lineNumber":214,"sourceCode":"    private FieldName fieldName;\n    private VectorAlgorithm algorithm;\n    private Map<String, Object> attributes;\n\n    /**\n     * Private constructor to enforce use of the static builder() method.\n     */\n    private Builder() {\n    }\n\n    /**\n     * Builds and returns a new VectorField instance with the configured properties.\n     *\n     * @return a new VectorField instance\n     * @throws IllegalArgumentException if required parameters (fieldName, algorithm, or attributes) are not set\n     */\n    public VectorField build() {\n      if (fieldName == null || algorithm == null || attributes == null || attributes.isEmpty()) {\n        throw new IllegalArgumentException(\"All required VectorField parameters are not set.\");\n      }\n      return new VectorField(fieldName, algorithm, attributes);\n    }\n\n    /**\n     * Sets the field name for the vector field.\n     *\n     * @param fieldName the name of the vector field in the index\n     * @return this Builder instance for method chaining\n     */\n    public Builder fieldName(String fieldName) {\n      this.fieldName = FieldName.of(fieldName);\n      return this;\n    }\n\n    /**\n     * Sets the field name using a FieldName object.\n     *","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/search/schemafields/VectorField.java#L196-L232","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Chain all required builder calls: fieldName, algorithm, and at least one attribute (TYPE, DIM, DISTANCE_METRIC) before build().","Ensure DIM matches your embedding size and attributes map is populated from valid config before building.","Validate the source configuration early and fail with a clear message if vector parameters are missing."],"exampleFix":"// before\nVectorField f = new VectorField.Builder(\"emb\").build(); // throws\n// after\nMap<String, Object> attrs = new HashMap<>();\nattrs.put(\"TYPE\", \"FLOAT32\"); attrs.put(\"DIM\", 768); attrs.put(\"DISTANCE_METRIC\", \"COSINE\");\nVectorField f = new VectorField.Builder(\"emb\").algorithm(VectorField.VectorAlgorithm.HNSW).addAttributes(attrs).build();","handlingStrategy":"validation","validationCode":"if (fieldName == null || algorithm == null || attrs == null || attrs.isEmpty()) {\n  throw new IllegalStateException(\"Vector field requires fieldName, algorithm and non-empty attributes\");\n}\nVectorField f = new VectorField.Builder(fieldName).algorithm(algorithm).addAttributes(attrs).build();","typeGuard":"boolean canBuildVectorField(String name, VectorField.VectorAlgorithm alg, Map<String,Object> attrs) {\n  return name != null && !name.isEmpty() && alg != null && attrs != null && !attrs.isEmpty();\n}","tryCatchPattern":"try {\n  field = builder.build();\n} catch (IllegalArgumentException e) {\n  throw new IllegalStateException(\"Incomplete vector field configuration: \" + e.getMessage(), e);\n}","preventionTips":["Use one fluent chain that always sets fieldName, algorithm, and attributes before build().","Keep required vector attributes (TYPE, DIM, DISTANCE_METRIC) in a single validated config object.","Fail fast at startup if vector config is incomplete rather than at index-creation time."],"tags":["java","search","schema","builder-validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}