{"record":{"id":"fdbec38803aa7038","repo":"pulumi/pulumi","slug":"dependencies-must-be-an-iterable-str-or-none-got","errorCode":null,"errorMessage":"dependencies must be an Iterable[str] or None, got {type(dependencies).__name__}.","messagePattern":"dependencies must be an Iterable\\[str\\] or None, got (.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"sdk/python/lib/pulumi/provider/experimental/property_value.py","lineNumber":145,"sourceCode":"            or isinstance(value, Mapping)\n            or isinstance(value, ResourceReference)\n            or isinstance(value, Computed)\n        ):\n            raise TypeError(\n                f\"Unsupported value type: {type(value).__name__}. \"\n                f\"Expected one of: None, bool, float, str, Asset, Archive, Sequence, Mapping, ResourceReference, or Computed.\"\n            )\n\n        # Validate is_secret parameter.\n        if not isinstance(is_secret, bool):\n            raise TypeError(\n                f\"is_secret must be a bool, got {type(is_secret).__name__}.\"\n            )\n\n        # Validate dependencies parameter.\n        if dependencies is not None:\n            if not isinstance(dependencies, Iterable):\n                raise TypeError(\n                    f\"dependencies must be an Iterable[str] or None, got {type(dependencies).__name__}.\"\n                )\n            # Validate that all items in dependencies are strings.\n            for dep in dependencies:\n                if not isinstance(dep, str):\n                    raise TypeError(\n                        f\"All dependencies must be strings, found {type(dep).__name__}.\"\n                    )\n\n        # Validate Sequence and Mapping types and wrap in immutable types to ensure they are hashable.\n        if isinstance(value, Sequence) and not isinstance(value, str):\n            # Validate all items in the sequence are PropertyValue instances.\n            for i, item in enumerate(value):\n                if not isinstance(item, PropertyValue):\n                    raise TypeError(\n                        f\"Sequence items must be PropertyValue instances, found {type(item).__name__} at index {i}.\"\n                    )\n            value = tuple(value)","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/python/lib/pulumi/provider/experimental/property_value.py#L127-L163","documentation":"A TypeError raised by the property-value construction logic when the dependencies parameter is neither None nor an iterable of strings. Dependencies must be a list/collection of resource URN strings; anything else (non-iterable, or an iterable containing non-strings) is rejected.","triggerScenarios":"Calling the property-value wrapper with dependencies set to a single string instead of a list of strings, a dict, or a list containing non-string items like resource objects or ints.","commonSituations":"Passing a bare URN string (strings are iterable but their items are chars, caught by the per-item str check), passing Pulumi resource objects instead of their .urn values, deserialized JSON where dependencies came through as something else.","solutions":["Pass a list of URN strings, e.g. [res.urn] rather than res or res.urn","Map resource objects to their URNs: dependencies=[r.urn for r in resources]","If there are no dependencies, pass None explicitly","Pre-validate with a check that all items are strings before calling the API"],"exampleFix":"# before\nmake_value(x, dependencies=res.urn)  # a single string\n# after\nmake_value(x, dependencies=[res.urn])","handlingStrategy":"type-guard","validationCode":"def check_dependencies(deps) -> None:\n    if deps is None:\n        return\n    if not isinstance(deps, (list, tuple)) or not all(isinstance(d, str) for d in deps):\n        raise TypeError(\"dependencies must be a list of URN strings or None\")","typeGuard":"def is_urn_list(v) -> bool:\n    return v is None or (isinstance(v, (list, tuple)) and all(isinstance(d, str) for d in v))","tryCatchPattern":"try:\n    make_property_value(value, dependencies=deps)\nexcept TypeError as e:\n    print(f\"fix dependencies (use [res.urn] or None): {e}\")\n    raise","preventionTips":["Always pass resource .urn values, not the resource objects themselves","Wrap single dependency strings in a list before passing","Use pyright/mypy with typed signatures to catch list[str] mismatches early"],"tags":["python","pulumi","type-error","dependencies"],"backgroundTag":"invalid-argument-type","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}