Terraform: Error: Invalid function argument — Invalid value for "list" parameter: list of string required / Call to function "lookup" failed
A built-in function got a wrong type/value (empty list, missing key, wrong type).
Error: Invalid function argumentInvalid value for "list" parameter: list of string requiredError: Error in function call: Call to function "lookup" failed: the given key does not exist in the given mapError: Invalid function argument Invalid value for "path" parameter: no file exists atCall to function "element" failed: cannot use element function with an empty list Meaning
Read the function and parameter named. Common: element()/[0] on empty lists, lookup() without a default, file() path missing, tonumber("abc"), merge with null, join of non-strings. Test in terraform console. Use try(), coalesce(), lookup(map, key, default), length() guards.
Common causes
- Indexing an empty list
lookupkey missing and no defaultfile("path")doesn't exist- Type conversion failures
- Passing null to functions requiring values
⚡ Quick fix
lookup(var.map, key, null)/try(expr, default)- Check lists with
length(x) > 0 ? x[0] : null fileexists()beforefile()
Detailed fix by platform
Terraform
terraform consolethen> lookup({a=1}, "b", 0)
How to diagnose
- Function — Which?
- Argument — Type/value?
- Guard — try/default?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Error building ARM Config: obtain subscription from Azure CLI Terraform: Error: building AzureRM Client: obtaining subscription ID / Please run 'az login' to setup account
- Inconsistent conditional result types Terraform: Error: Inconsistent conditional result types — The true and false result expressions must have consistent types
- Invalid AWS Region Terraform: Error: Invalid AWS Region: us-east-3 / Error: configuring Terraform AWS Provider: validating provider credentials: operation error STS: GetCallerIdentity
Most viewed in Terraform
- Error acquiring the state lock Terraform: Error: Error acquiring the state lock — ConditionalCheckFailedException / state blob is already locked
- Inconsistent dependency lock file Terraform: Error: Inconsistent dependency lock file — provider x: required by this configuration but no version is selected
- Reference to undeclared resource Terraform: Error: Reference to undeclared resource / Reference to undeclared input variable
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026