quickwit-oss/tantivy · error · DeserializeError

No field type is associated with code {type_code:?}

Error message

No field type is associated with code {type_code:?}

What it means

Value deserialization dispatches on a one-byte type code (str/u64/date/etc.). The catch-all arm converts any unrecognized code into a DeserializeError with this message, because the byte does not map to any known ValueType — the stream is corrupt or written by an incompatible version.

Source

Thrown at src/schema/document/de.rs:400

                    type_codes::TOK_STR_EXT_CODE => ValueType::PreTokStr,
                    _ => {
                        return Err(DeserializeError::from(io::Error::new(
                            io::ErrorKind::InvalidData,
                            format!(
                                "No extended field type is associated with code {ext_type_code:?}"
                            ),
                        )))
                    }
                }
            }
            type_codes::IP_CODE => ValueType::IpAddr,
            type_codes::NULL_CODE => ValueType::Null,
            type_codes::ARRAY_CODE => ValueType::Array,
            type_codes::OBJECT_CODE => ValueType::Object,
            #[expect(deprecated)]
            type_codes::JSON_OBJ_CODE => ValueType::JSONObject,
            _ => {
                return Err(DeserializeError::from(io::Error::new(
                    io::ErrorKind::InvalidData,
                    format!("No field type is associated with code {type_code:?}"),
                )))
            }
        };

        Ok(Self {
            value_type,
            reader,
            doc_store_version,
        })
    }

    fn validate_type(&self, expected_type: ValueType) -> Result<(), DeserializeError> {
        if self.value_type == expected_type {
            Ok(())
        } else {
            Err(DeserializeError::TypeMismatch {

View on GitHub (pinned to b5d8deb80c)

Solutions

  1. Upgrade tantivy to match or exceed the version that wrote the data
  2. Restore from backup or re-index the affected documents
  3. If writing bytes manually, use only documented type_codes constants
  4. Verify corruption by checking whether the same document fails consistently
Defensive patterns

Strategy: try-catch

Try / catch

match from_reader_result {
    Err(e) if e.to_string().contains("No field type is associated") => {
        eprintln!("unknown Value type code; check tantivy version/corruption");
    }
    Err(e) => return Err(e),
    Ok(v) => v,
}

Prevention

When it happens

Trigger: from_reader encountering an unknown type_code byte: data written by a newer tantivy with added ValueTypes, corrupted stored documents, or manual/test serialization emitting invalid codes.

Common situations: Reading indexes or JSON-ish snapshots across tantivy versions (forward-compatibility breaks); memory/disk corruption in stored fields; custom tools writing raw Value encodings incorrectly.

Related errors


AI-assisted analysis of quickwit-oss/tantivy@b5d8deb80c (2026-09-05). Data as JSON: /api/errors/8b6669954945cd35. Report an issue: GitHub.