pulumi/pulumi · error

remoteAsset requires a uri argument

Error message

remoteAsset requires a uri argument

What it means

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.

Source

Thrown at pkg/pcl/runtime/builtinFunctions.go:771

			a, err := asset.FromText(text)
			if err != nil {
				return cty.NilVal, fmt.Errorf("creating string asset: %w", err)
			}
			return propertyValueToCty(context.TODO(), ectx.getResource, resource.NewProperty(a))
		},
	})

	remoteAssetFn := function.New(&function.Spec{
		Params: []function.Parameter{
			{
				Name: "uri",
				Type: cty.String,
			},
		},
		Type: function.StaticReturnType(assetType),
		Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
			if len(args) != 1 {
				return cty.NilVal, errors.New("remoteAsset requires a uri argument")
			}
			if args[0].Type() != cty.String {
				return cty.NilVal, errors.New("remoteAsset uri must be a string")
			}
			uri := args[0].AsString()
			a, err := asset.FromURI(uri)
			if err != nil {
				return cty.NilVal, fmt.Errorf("creating remote asset: %w", err)
			}
			return propertyValueToCty(context.TODO(), ectx.getResource, resource.NewProperty(a))
		},
	})

	remoteArchiveFn := function.New(&function.Spec{
		Params: []function.Parameter{
			{
				Name: "uri",
				Type: cty.String,

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Pass exactly one URI string: remoteAsset("https://example.com/logo.png").
  2. Fix the PCL expression to supply the single uri argument.
  3. If invoking from Go, pass a one-element []cty.Value containing cty.StringVal(uri).

Example fix

// before
remoteAsset()
// after
remoteAsset("https://example.com/file.txt")
Defensive patterns

Strategy: validation

Validate before calling

// Go
if len(args) != 1 {
    return fmt.Errorf("remoteAsset needs exactly one uri argument, got %d", len(args))
}

Try / catch

// Go
v, err := remoteAssetFn.Call(args)
if err != nil && strings.Contains(err.Error(), "remoteAsset requires a uri argument") {
    return fmt.Errorf("check your PCL program: remoteAsset must be called as remoteAsset(uri)")
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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