{"record":{"id":"8868278eb1cd037e","repo":"quickwit-oss/tantivy","slug":"the-json-field-does-not-support-custom-field-types-886827","errorCode":null,"errorMessage":"the JSON field does not support custom field types","messagePattern":"the JSON field does not support custom field types","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/fastfield/writer.rs","lineNumber":354,"sourceCode":"            }\n            ReferenceValueLeaf::Facet(_) => {\n                unimplemented!(\"Facet support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::Bytes(_) => {\n                // TODO: This can be re added once it is added to the JSON Utils section as well.\n                // columnar_writer.record_bytes(doc, json_path_writer.as_str(), val);\n                unimplemented!(\"Bytes support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::IpAddr(_) => {\n                unimplemented!(\"IP address support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::PreTokStr(_) => {\n                unimplemented!(\n                    \"Pre-tokenized string support in dynamic fields is not yet implemented\"\n                )\n            }\n            ReferenceValueLeaf::Custom(_) => {\n                unimplemented!(\"the JSON field does not support custom field types\")\n            }\n        },\n        ReferenceValue::Array(elements) => {\n            for el in elements {\n                record_json_value_to_columnar_writer(\n                    doc,\n                    el,\n                    remaining_depth_limit,\n                    json_path_writer,\n                    columnar_writer,\n                    tokenizer,\n                );\n            }\n        }\n        ReferenceValue::Object(object) => {\n            record_json_obj_to_columnar_writer::<V>(\n                doc,\n                object,","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/fastfield/writer.rs#L336-L372","documentation":"Custom leaf values (custom ReferenceValue types) are rejected by the JSON dynamic field columnar writer. The JSON field only supports a fixed set of leaf types; anything Custom is explicitly unimplemented. This surfaces as a panic, not a recoverable error.","triggerScenarios":"record_json_value_to_columnar_writer encountering ReferenceValueLeaf::Custom(_) — i.e. indexing a JSON dynamic field whose value is a custom field type, including through Array elements.","commonSituations":"Extending tantivy with a custom fast-field type and attempting to place it inside JSON dynamic fields; third-party plugins inserting custom leaf values into json fields.","solutions":["Do not put custom field types inside JSON dynamic fields; use a dedicated field.","Flatten the custom type into a supported leaf (string, u64, i64, f64, bool, date) before adding to the JSON object.","Encode the custom value into a supported representation (e.g. bytes stored elsewhere).","Contribute/patch support for custom types upstream."],"exampleFix":"// before\njson_field.add_json_object(doc, json!({\"geo\": custom_value})); // Custom leaf -> panic\n// after\njson_field.add_json_object(doc, json!({\"geo\": custom_value.to_string()})); // supported leaf","handlingStrategy":"validation","validationCode":"fn is_supported_leaf(v: &ReferenceValueLeaf) -> bool {\n    !matches!(v, ReferenceValueLeaf::Custom(_) | ReferenceValueLeaf::IpAddr(_) | ReferenceValueLeaf::PreTokStr(_) | ReferenceValueLeaf::Bytes(_))\n}","typeGuard":"fn is_custom_leaf(v: &ReferenceValueLeaf) -> bool {\n    matches!(v, ReferenceValueLeaf::Custom(_))\n}","tryCatchPattern":null,"preventionTips":["Restrict custom types to dedicated schema fields.","Flatten custom values into supported primitives before JSON indexing.","Keep a central enum of allowed JSON leaf types in your ingestion layer."],"tags":["unimplemented","fastfield","json","custom-type"],"backgroundTag":"unimplemented-fastfield-json-type","analyzedSha":"b5d8deb80c26924e6b007a5b1a7630f35ca64de4","analyzedAt":"2026-09-05T13:20:51.521Z","contentChangedAt":"2026-09-05T13:20:51.521Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}