hashicorp/terraform · error
${protoResp.Error.Text}
Error message
${protoResp.Error.Text} What it means
Thrown by GRPCProvider.CallFunction (plugin v5) when the provider's CallFunction RPC returned a non-nil `Error` in the response. Provider-defined functions report errors via an Error struct containing a Text field; that text is wrapped as a plain error. If Error.FunctionArgument is set, the error is additionally wrapped in function.NewArgError to point at the offending argument.
Source
Thrown at internal/plugin/grpc_provider.go:1296
args[i] = &proto.DynamicValue{
Msgpack: argValRaw,
}
}
protoResp, err := p.client.CallFunction(p.ctx, &proto.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 respView on GitHub (pinned to d32a084675)
Solutions
- Read the FunctionArgument index in the diagnostic — it identifies the offending argument; correct that input.
- Upgrade the provider; function implementations mature across versions.
- Open an issue with the provider including the exact call and inputs.
Example fix
# before
output "x" { value = provider::myprov::my_function("bad") }
# after
output "x" { value = provider::myprov::my_function("valid-input") } Defensive patterns
Strategy: try-catch
Validate before calling
# HCL: validate function inputs match documented contract before calling
locals { ok = can(provider::myprov::my_function("valid")) } Try / catch
# HCL: try() around a provider function call
locals { out = try(provider::myprov::my_function(var.input), null) } Prevention
- Read the provider function's documented argument constraints before use.
- Wrap provider function calls in try() to degrade gracefully.
- Pin provider versions so function behavior is stable.
When it happens
Trigger: Invoking a provider-defined function (the provider_functions feature) whose implementation returned an error — e.g., invalid argument semantics, a runtime failure inside the function.
Common situations: Passing a value that passes type-checking but is rejected by the function's runtime logic. A provider function with a bug or that depends on external state. Argument index reported points to which input caused it.
Related errors
- missing provider schema
- ${resp.Error}
- ${protoResp.Error.Text}
- missing provisioner schema
- ${protoResp.Error}
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/6585bbcc01f67561.
Report an issue: GitHub.