microsoft/semantic-kernel · error · VectorStoreOperationException

Unsupported scalar field type: {field_type_str}

Error message

Unsupported scalar field type: {field_type_str}

What it means

Thrown by _map_scalar_field_type_to_oracle when a key or data field's type string does not match any known Python-to-Oracle mapping (bool, byte, int, long, float, double, Decimal, UUID, date, datetime, timedelta, bytes, dict, clob, blob, or list[...]/dict[...]/str patterns). Used during DDL generation for non-vector fields.

Source

Thrown at python/semantic_kernel/connectors/oracle.py:163

        "clob": "CLOB",
        "blob": "BLOB",
    }

    list_pattern = re.compile(r"list\[(.*)\]")
    if list_pattern.match(field_type_str):
        return "JSON"

    dict_pattern = re.compile(r"dict\[(.*?),\s*(.*?)\]")
    if dict_pattern.match(field_type_str):
        return "JSON"

    str_match = re.match(r"str(?:\((\d+)\))?$", field_type_str)
    if str_match:
        size = str_match.group(1) or "4000"
        return f"VARCHAR2({size})"

    if field_type_str not in type_mapping:
        raise VectorStoreOperationException(f"Unsupported scalar field type: {field_type_str}")

    return type_mapping.get(field_type_str)


def _sk_vector_element_to_oracle(field_type_str: str) -> str | None:
    """Convert a Semantic Kernel vector element type string to an Oracle VECTOR element type string."""
    list_pattern = re.compile(r"(?i)^list\[(.*)\]$")
    field_type = field_type_str.strip()

    # Iteratively unwrap list[...] until no longer matches
    while True:
        match = list_pattern.match(field_type)
        if not match:
            break
        field_type = match.group(1).strip()

    # Return final mapped type if available
    return VECTOR_TYPE_MAPPING.get(field_type)

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Map the field to a supported scalar type: str, int, long, float, double, bool, datetime, date, bytes, UUID
  2. For complex/structured data use dict or list[...] which map to Oracle JSON columns
  3. For variable-length strings use str or str(N) which map to VARCHAR2
  4. Check the field type_ spelling against the supported set in _map_scalar_field_type_to_oracle

Example fix

# before
definition = VectorStoreCollectionDefinition(
    key_field=VectorStoreField(name='id', type_='str'),
    data_fields=[VectorStoreField(name='tags', type_='set[str]')],  # unsupported -> 1508
)

# after - use list[...] which maps to JSON
definition = VectorStoreCollectionDefinition(
    key_field=VectorStoreField(name='id', type_='str'),
    data_fields=[VectorStoreField(name='tags', type_='list[str]')],  # maps to JSON
)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_SCALAR = {'bool','byte','int','long','float','double','Decimal','UUID','date','datetime','timedelta','bytes','dict','clob','blob'}
import re

def is_supported_scalar(t: str) -> bool:
    if t in SUPPORTED_SCALAR:
        return True
    if re.match(r'list\[.*\]', t) or re.match(r'dict\[(.*?),\s*(.*?)\]', t):
        return True
    if re.match(r'str(?:\((\d+)\))?$', t):
        return True
    return False

for f in all_fields:
    if f.field_type != 'vector' and not is_supported_scalar(f.type_ or ''):
        raise ValueError(f'Unsupported scalar type {f.type_} on {f.name}')

Try / catch

from semantic_kernel.exceptions import VectorStoreOperationException

try:
    await collection.ensure_collection_exists()
except VectorStoreOperationException as e:
    if 'Unsupported scalar field type' in str(e):
        # fix the offending field type_ in the definition
        ...

Prevention

When it happens

Trigger: Defining a VectorStoreField with type_ set to an unsupported value (e.g. 'set', 'tuple', 'complex', a custom class name) for a key or data field, then triggering ensure_collection_exists / table creation.

Common situations: Custom field types without a mapping; typo in the type string; using a Python type the connector does not support; Decimal spelled as 'decimal'.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/bb78cfd963a6094b. Report an issue: GitHub.