{"record":{"id":"f08e43055b7252b9","repo":"pulumi/pulumi","slug":"remotearchive-uri-must-be-a-string-f08e43","errorCode":null,"errorMessage":"RemoteArchive URI must be a string","messagePattern":"RemoteArchive URI must be a string","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"sdk/python/lib/pulumi/asset.py","lineNumber":124,"sourceCode":"\n    def __init__(self, path: str) -> None:\n        if not isinstance(path, str):\n            raise TypeError(\"FileArchive path must be a string\")\n        self.path = path\n\n\nclass RemoteArchive(Archive):\n    \"\"\"\n    A RemoteArchive is a file-based archive fetched from a remote location.  The URI's scheme dictates\n    the protocol for fetching contents: \"file://\" specifies a local file, \"http://\" and \"https://\"\n    specify HTTP and HTTPS, respectively, and specific providers may recognize custom schemes.\n    \"\"\"\n\n    uri: str\n\n    def __init__(self, uri: str) -> None:\n        if not isinstance(uri, str):\n            raise TypeError(\"RemoteArchive URI must be a string\")\n        self.uri = uri\n","sourceCodeStart":106,"sourceCodeEnd":126,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/python/lib/pulumi/asset.py#L106-L126","documentation":"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.","triggerScenarios":"Calling RemoteArchive() with bytes, None, pathlib.Path, or another non-string type.","commonSituations":"Passing a config value that resolved to None, or a pathlib.Path/URL object instead of its string form.","solutions":["Cast explicitly: RemoteArchive(str(uri))","Ensure the source of the URI actually yields a string (check for None from config lookups)"],"exampleFix":"// before\narch = RemoteArchive(config.get(\"archive_url\"))  # may be None\n// after\nurl = config.get(\"archive_url\") or \"https://example.com/arch.tgz\"\narch = RemoteArchive(url)","handlingStrategy":"type-guard","validationCode":"if uri is None:\n    raise ValueError(\"remote archive URI not configured\")\nif not isinstance(uri, str):\n    uri = str(uri)","typeGuard":"def is_uri_str(v: object) -> bool:\n    return isinstance(v, str)","tryCatchPattern":"try:\n    archive = RemoteArchive(uri)\nexcept TypeError as e:\n    logging.error(\"Bad RemoteArchive URI: %s\", e)\n    archive = RemoteArchive(str(uri))","preventionTips":["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"],"tags":["python","validation","assets"],"backgroundTag":"invalid-argument-type","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}