pulumi/pulumi · error · TypeError

Unsupported value type: {type(value).__name__}. Expected one

Error message

Unsupported value type: {type(value).__name__}. Expected one of: None, bool, float, str, Asset, Archive, Sequence, Mapping, ResourceReference, or Computed.

What it means

A TypeError raised during input/output marshaling (property value serialization) when a value is not one of the supported primitive or structural Pulumi types: None, bool, float, str, Asset, Archive, Sequence, Mapping, ResourceReference, or Computed. The serializer cannot convert arbitrary Python objects to protocol values.

Source

Thrown at sdk/python/lib/pulumi/provider/experimental/property_value.py:131

        """
        :param value: The value of the property.
        :param is_secret: Whether the value is secret.
        :param dependencies: The dependencies of the property value.
        """
        # Validate that value is a supported type.
        if not (
            value is None
            or isinstance(value, bool)
            or isinstance(value, float)
            or isinstance(value, str)
            or isinstance(value, pulumi.Asset)
            or isinstance(value, pulumi.Archive)
            or isinstance(value, Sequence)
            or isinstance(value, Mapping)
            or isinstance(value, ResourceReference)
            or isinstance(value, Computed)
        ):
            raise TypeError(
                f"Unsupported value type: {type(value).__name__}. "
                f"Expected one of: None, bool, float, str, Asset, Archive, Sequence, Mapping, ResourceReference, or Computed."
            )

        # Validate is_secret parameter.
        if not isinstance(is_secret, bool):
            raise TypeError(
                f"is_secret must be a bool, got {type(is_secret).__name__}."
            )

        # Validate dependencies parameter.
        if dependencies is not None:
            if not isinstance(dependencies, Iterable):
                raise TypeError(
                    f"dependencies must be an Iterable[str] or None, got {type(dependencies).__name__}."
                )
            # Validate that all items in dependencies are strings.
            for dep in dependencies:

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Convert the value to a supported type: use list(...) for sets, str(...) for datetimes, float(...) for Decimal, dict(...) for custom objects
  2. Convert bytes to a base64 str or an Asset before passing
  3. Only pass plain JSON-like structures (dict/list/str/num/bool/None) or Pulumi types (Asset/Archive/Computed/ResourceReference)
  4. Fix the component schema so the property is typed for the structure you need (e.g. object type) instead of passing raw objects

Example fix

# before
MyComponent("res", {"tags": {"a", "b"}})  # set unsupported
# after
MyComponent("res", {"tags": ["a", "b"]})
Defensive patterns

Strategy: type-guard

Validate before calling

from typing import Sequence, Mapping
import pulumi
SUPPORTED = (type(None), bool, float, str, pulumi.Asset, pulumi.Archive,
             Sequence, Mapping, pulumi.ResourceReference, pulumi.Computed)
def check_supported(v) -> None:
    if not isinstance(v, SUPPORTED):
        raise TypeError(f"unsupported type {type(v).__name__}")

Type guard

def is_marshallable(v) -> bool:
    return isinstance(v, (type(None), bool, float, str, pulumi.Asset,
        pulumi.Archive, Sequence, Mapping, pulumi.ResourceReference, pulumi.Computed))

Try / catch

try:
    make_property_value(value)
except TypeError as e:
    print(f"convert {value!r} to a supported type: {e}")
    raise

Prevention

When it happens

Trigger: Passing an unsupported Python object (set, bytes, custom class instance, int-wrapped Decimal, datetime) as a component input or property value that gets processed by the property-value serialization logic.

Common situations: Passing a set or bytes from Python code, datetime/date objects for timestamps instead of strings, numpy or Decimal numeric types, custom dataclasses not converted to Mappings.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/789497c8ed1dda38. Report an issue: GitHub.