{"record":{"id":"13eb8369ec552ac9","repo":"quickwit-oss/tantivy","slug":"bytes-support-in-dynamic-fields-is-not-yet-impleme","errorCode":null,"errorMessage":"Bytes support in dynamic fields is not yet implemented","messagePattern":"Bytes support in dynamic fields is not yet implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/json_utils.rs","lineNumber":222,"sourceCode":"                postings_writer.subscribe(doc, 0u32, term_buffer, ctx);\n            }\n            ReferenceValueLeaf::Date(val) => {\n                set_path_id(\n                    term_buffer,\n                    ctx.path_to_unordered_id\n                        .get_or_allocate_unordered_id(json_path_writer.as_str()),\n                );\n                let val = val.truncate(DATE_TIME_PRECISION_INDEXED);\n                term_buffer.append_type_and_fast_value(val);\n                postings_writer.subscribe(doc, 0u32, term_buffer, ctx);\n            }\n            ReferenceValueLeaf::PreTokStr(_) => {\n                unimplemented!(\n                    \"Pre-tokenized string support in dynamic fields is not yet implemented\"\n                )\n            }\n            ReferenceValueLeaf::Bytes(_) => {\n                unimplemented!(\"Bytes support in dynamic fields is not yet implemented\")\n            }\n            ReferenceValueLeaf::Facet(_) => {\n                unimplemented!(\"Facet 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::Custom(_) => {\n                unimplemented!(\"the JSON field does not support custom field types\")\n            }\n        },\n        ReferenceValue::Array(elements) => {\n            for val in elements {\n                index_json_value(\n                    doc,\n                    val,\n                    text_analyzer,\n                    term_buffer,","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/quickwit-oss/tantivy/blob/b5d8deb80c26924e6b007a5b1a7630f35ca64de4/src/core/json_utils.rs#L204-L240","documentation":"index_json_value panics via unimplemented!() when a dynamically-typed JSON leaf is Bytes. Byte-array values cannot yet be indexed inside dynamic JSON fields; only schema-declared bytes fields support them. The panic is intentional placeholder behavior.","triggerScenarios":"Indexing a document whose JSON field value is a Bytes leaf (e.g. a tantivy Bytes value inserted into a JSON object) through index_document.","commonSituations":"Trying to store binary blobs inside JSON fields; migrating documents from typed fields to dynamic JSON fields without converting byte values.","solutions":["Declare a bytes field in the schema and index the value there instead","Base64/hex-encode the bytes as a string inside the JSON field if approximate retrieval suffices","Drop the byte value from JSON documents before indexing"],"exampleFix":"// before\njson_obj.insert(\"blob\", Value::Bytes(bytes));\n// after\nlet blob = schema_builder.add_bytes_field(\"blob\", STORED); // typed field for bytes","handlingStrategy":"validation","validationCode":"fn json_has_bytes(v: &serde_json::Value) -> bool {\n    match v {\n        serde_json::Value::Array(a) => a.iter().any(json_has_bytes),\n        serde_json::Value::Object(o) => o.values().any(json_has_bytes),\n        _ => false,\n    }\n}\n// reject binary blobs before indexing: assert!(!json_has_bytes(&doc_value));","typeGuard":"fn is_bytes_leaf(v: &tantivy::schema::Value) -> bool {\n    matches!(v.as_value(), tantivy::schema::ReferenceValueLeaf::Bytes(_))\n}","tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| index_writer.add_document(doc)));\nif result.is_err() { eprintln!(\"dynamic JSON field contained Bytes\"); }","preventionTips":["Use schema-typed bytes fields for binary data","Store blobs in JSON only as base64/hex strings","Validate document payloads before add_document","Audit migrations that convert typed fields into JSON fields"],"tags":["rust","unimplemented","json","dynamic-fields","bytes"],"backgroundTag":"unimplemented-dynamic-field-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"}