vectordotdev/vector · error

Schema type was not able to be detected!

Error message

Schema type was not able to be detected!

What it means

After checking instance types, reference, subschemas, arrays/objects, and enum values, `schema_type` in the schema query parser gives up: the schema node matches none of the recognized shapes. Since the parser expects every schema it visits to be classifiable into a `SchemaType`, it panics with this message. It usually indicates a schema that is effectively empty or uses constructs the parser doesn't model (e.g. no `type`, no `enum`, no combinators).

Solutions

  1. Add an explicit `type` (or `enum`) to the schema node so it can be classified
  2. Replace an empty/`const`-only schema with one carrying a recognized `type` or `enum` definition
  3. Check whether the schema was truncated or stripped by preprocessing and regenerate it

Example fix

// before
{}
// after
{ "type": "string" }
Defensive patterns

Strategy: type-guard

Validate before calling

fn schema_is_classifiable(schema: &serde_json::Value) -> bool {
    schema.get("type").is_some()
        || schema.get("enum").is_some()
        || schema.get("$ref").is_some()
        || ["allOf", "oneOf", "anyOf"].iter().any(|k| schema.get(k).is_some())
}

Type guard

fn is_empty_schema(v: &serde_json::Value) -> bool {
    v.as_object().map_or(false, |o| o.is_empty())
}

Prevention

When it happens

Trigger: Querying a schema node that has no `instance_type`, no `$ref`/reference, no allOf/oneOf/anyOf subschemas, no array/object constraints, and no `enum_values`, so control flow reaches `panic!("Schema type was not able to be detected!")` at lib/vector-config/src/schema/parser/query.rs:306.

Common situations: An empty schema `{}` in a document fed to the schema query tooling; a boolean-like or bare `true`/`false` schema; schemas relying on keywords the parser ignores (e.g. `const`, `format` only); truncated or hand-edited generated schemas.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/8943221fdb0b2313. Report an issue: GitHub.

Appendix: source

Thrown at lib/vector-config/src/schema/parser/query.rs:306

            }
        }

        if let Some(instance_types) = self.instance_type.as_ref() {
            return match instance_types {
                SingleOrVec::Single(single) => SchemaType::Typed(OneOrMany::One(*single.clone())),
                SingleOrVec::Vec(many) => SchemaType::Typed(OneOrMany::Many(many.clone())),
            };
        }

        if let Some(const_value) = self.const_value.as_ref() {
            return SchemaType::Constant(const_value);
        }

        if let Some(enum_values) = self.enum_values.as_ref() {
            return SchemaType::Enum(enum_values);
        }

        panic!("Schema type was not able to be detected!");
    }

    fn description(&self) -> Option<&str> {
        self.metadata
            .as_ref()
            .and_then(|metadata| metadata.description.as_deref())
    }

    fn title(&self) -> Option<&str> {
        self.metadata
            .as_ref()
            .and_then(|metadata| metadata.title.as_deref())
    }

    fn get_attributes(&self, key: &str) -> Option<OneOrMany<CustomAttribute>> {
        self.extensions.get(constants::METADATA)
            .map(|metadata| match metadata {
                Value::Object(attributes) => attributes,

View on GitHub (pinned to bdb87aeaa4)