pulumi/pulumi · error · TypeError
RemoteArchive URI must be a string
Error message
RemoteArchive URI must be a string
What it means
RemoteArchive represents an archive fetched from a remote URI. The constructor validates the uri is a str and raises TypeError otherwise, mirroring RemoteAsset's validation.
Source
Thrown at sdk/python/lib/pulumi/asset.py:124
def __init__(self, path: str) -> None:
if not isinstance(path, str):
raise TypeError("FileArchive path must be a string")
self.path = path
class RemoteArchive(Archive):
"""
A RemoteArchive is a file-based archive fetched from a remote location. The URI's scheme dictates
the protocol for fetching contents: "file://" specifies a local file, "http://" and "https://"
specify HTTP and HTTPS, respectively, and specific providers may recognize custom schemes.
"""
uri: str
def __init__(self, uri: str) -> None:
if not isinstance(uri, str):
raise TypeError("RemoteArchive URI must be a string")
self.uri = uri
View on GitHub (pinned to 793f7b2e16)
Solutions
- Cast explicitly: RemoteArchive(str(uri))
- Ensure the source of the URI actually yields a string (check for None from config lookups)
Example fix
// before
arch = RemoteArchive(config.get("archive_url")) # may be None
// after
url = config.get("archive_url") or "https://example.com/arch.tgz"
arch = RemoteArchive(url) Defensive patterns
Strategy: type-guard
Validate before calling
if uri is None:
raise ValueError("remote archive URI not configured")
if not isinstance(uri, str):
uri = str(uri) Type guard
def is_uri_str(v: object) -> bool:
return isinstance(v, str) Try / catch
try:
archive = RemoteArchive(uri)
except TypeError as e:
logging.error("Bad RemoteArchive URI: %s", e)
archive = RemoteArchive(str(uri)) Prevention
- Handle None results from config.get() before building the archive
- Store URIs as strings end-to-end
- Coerce URL objects with str() at the boundary
When it happens
Trigger: Calling RemoteArchive() with bytes, None, pathlib.Path, or another non-string type.
Common situations: Passing a config value that resolved to None, or a pathlib.Path/URL object instead of its string form.
Understand the failure class
Background: Invalid argument type errors: "must be of type string", "expected X, got Y", and ERR_INVALID_ARG_TYPE explained — this error's family across 15 libraries.
Related errors
- RemoteAsset URI must be a string
- AssetArchive assets must be a dictionary
- AssetArchive keys must be strings
- AssetArchive assets must contain only Assets or Archives
- FileArchive path must be a string
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/f08e43055b7252b9.
Report an issue: GitHub.