{"record":{"id":"9fef1b1e41c2c9a6","repo":"pulumi/pulumi","slug":"remoteasset-requires-a-uri-argument","errorCode":null,"errorMessage":"remoteAsset requires a uri argument","messagePattern":"remoteAsset requires a uri argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/pcl/runtime/builtinFunctions.go","lineNumber":771,"sourceCode":"\t\t\ta, err := asset.FromText(text)\n\t\t\tif err != nil {\n\t\t\t\treturn cty.NilVal, fmt.Errorf(\"creating string asset: %w\", err)\n\t\t\t}\n\t\t\treturn propertyValueToCty(context.TODO(), ectx.getResource, resource.NewProperty(a))\n\t\t},\n\t})\n\n\tremoteAssetFn := function.New(&function.Spec{\n\t\tParams: []function.Parameter{\n\t\t\t{\n\t\t\t\tName: \"uri\",\n\t\t\t\tType: cty.String,\n\t\t\t},\n\t\t},\n\t\tType: function.StaticReturnType(assetType),\n\t\tImpl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn cty.NilVal, errors.New(\"remoteAsset requires a uri argument\")\n\t\t\t}\n\t\t\tif args[0].Type() != cty.String {\n\t\t\t\treturn cty.NilVal, errors.New(\"remoteAsset uri must be a string\")\n\t\t\t}\n\t\t\turi := args[0].AsString()\n\t\t\ta, err := asset.FromURI(uri)\n\t\t\tif err != nil {\n\t\t\t\treturn cty.NilVal, fmt.Errorf(\"creating remote asset: %w\", err)\n\t\t\t}\n\t\t\treturn propertyValueToCty(context.TODO(), ectx.getResource, resource.NewProperty(a))\n\t\t},\n\t})\n\n\tremoteArchiveFn := function.New(&function.Spec{\n\t\tParams: []function.Parameter{\n\t\t\t{\n\t\t\t\tName: \"uri\",\n\t\t\t\tType: cty.String,","sourceCodeStart":753,"sourceCodeEnd":789,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/pcl/runtime/builtinFunctions.go#L753-L789","documentation":"The remoteAsset function in the PCL runtime builds a Pulumi asset referenced by URI (e.g. http(s) or file URLs). It requires exactly one argument; this guard throws when the Impl receives any other count. As with stringAsset, the cty function machinery normally enforces arity, so this surfaces mostly on direct or malformed invocations.","triggerScenarios":"Calling remoteAsset with zero or multiple arguments through the cty function API or a PCL program expression like remoteAsset() / remoteAsset(a, b) evaluated by the runtime.","commonSituations":"A .pp program with a missing argument (remoteAsset()), accidental extra argument from a bad interpolation, or custom tooling invoking the registered function directly without the declared arity.","solutions":["Pass exactly one URI string: remoteAsset(\"https://example.com/logo.png\").","Fix the PCL expression to supply the single uri argument.","If invoking from Go, pass a one-element []cty.Value containing cty.StringVal(uri)."],"exampleFix":"// before\nremoteAsset()\n// after\nremoteAsset(\"https://example.com/file.txt\")","handlingStrategy":"validation","validationCode":"// Go\nif len(args) != 1 {\n    return fmt.Errorf(\"remoteAsset needs exactly one uri argument, got %d\", len(args))\n}","typeGuard":null,"tryCatchPattern":"// Go\nv, err := remoteAssetFn.Call(args)\nif err != nil && strings.Contains(err.Error(), \"remoteAsset requires a uri argument\") {\n    return fmt.Errorf(\"check your PCL program: remoteAsset must be called as remoteAsset(uri)\")\n}","preventionTips":["In .pp programs always pass one quoted URI: remoteAsset(\"https://...\").","Invoke via the PCL evaluator so arity is enforced before Impl.","Review generated code that emits remoteAsset calls for missing arguments."],"tags":["pcl","cty","assets","argument-count"],"backgroundTag":"missing-required-argument","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}