hashicorp/terraform · error

${protoResp.Error.Text}

Error message

${protoResp.Error.Text}

What it means

Thrown by GRPCProvider.CallFunction (plugin v6) when CallFunction RPC returned a non-nil `Error` in the response. Provider-defined functions report errors via Error.Text; that text is wrapped as a plain error and, if FunctionArgument is set, additionally wrapped in function.NewArgError to identify the offending argument. Identical semantics to the v5 path.

Source

Thrown at internal/plugin6/grpc_provider.go:1304

		args[i] = &proto6.DynamicValue{
			Msgpack: argValRaw,
		}
	}

	protoResp, err := p.client.CallFunction(p.ctx, &proto6.CallFunction_Request{
		Name:      r.FunctionName,
		Arguments: args,
	})
	if err != nil {
		// functions can only support simple errors, but use our grpcError
		// diagnostic function to format common problems is a more
		// user-friendly manner.
		resp.Err = grpcErr(err).Err()
		return resp
	}

	if protoResp.Error != nil {
		resp.Err = errors.New(protoResp.Error.Text)

		// If this is a problem with a specific argument, we can wrap the error
		// in a function.ArgError
		if protoResp.Error.FunctionArgument != nil {
			resp.Err = function.NewArgError(int(*protoResp.Error.FunctionArgument), resp.Err)
		}

		return resp
	}

	resultVal, err := decodeDynamicValue(protoResp.Result, funcDecl.ReturnType)
	if err != nil {
		resp.Err = err
		return resp
	}

	resp.Result = resultVal
	return resp

View on GitHub (pinned to d32a084675)

Solutions

  1. Use the reported FunctionArgument index to identify and fix the offending argument.
  2. Upgrade the provider; provider function behavior stabilizes across releases.
  3. Report the issue to the provider maintainer with the call and inputs.

Example fix

# before
output "x" { value = provider::myprov::compute("bad") }

# after
output "x" { value = provider::myprov::compute("valid") }
Defensive patterns

Strategy: try-catch

Validate before calling

# HCL: sanity-check inputs before the call
locals { ok = can(provider::myprov::compute("valid")) }

Try / catch

# HCL: try() around the v6 provider function
locals { out = try(provider::myprov::compute(var.input), null) }

Prevention

When it happens

Trigger: Calling a v6 provider-defined function whose implementation returned a runtime error or rejected an argument's value.

Common situations: A function argument that passes type-checking but fails value validation inside the function. A buggy provider function or one depending on unavailable external state.

Related errors


AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11). Data as JSON: /api/errors/fcb1fa25e7b3e9dd. Report an issue: GitHub.