Error Conditions

Every error condition the function can produce.

The following conditions are treated as errors by function-hcl. When an error occurs, the function returns a Fatal result that surfaces on the composite resource.

Parsing Errors

ErrorDescription
HCL syntax errorInvalid HCL syntax in the source files
Schema violationBlock structure doesn’t match the expected schema

Variable Errors

ErrorDescription
Unknown local variableReference to a local variable name that doesn’t exist
Circular referenceCircular dependencies in locals (e.g. locals { a = b; b = a })
Local shadowingA local variable in an inner scope has the same name as one in a parent scope

Resource Errors

ErrorDescription
Duplicate resource nameTwo resources produce the same crossplane name
Existing resource became incompleteA resource that exists in the observed state now has an incomplete value. This is a safety check to prevent accidental deletion.

Condition Errors

ErrorDescription
Incomplete conditionA condition value that cannot be evaluated (note: incomplete conditions are treated as false, but certain evaluation failures are errors)
Non-boolean conditionA condition evaluates to something other than true or false

Status and Connection Errors

ErrorDescription
Conflicting status valuesTwo composite status blocks set the same non-object leaf attribute to different values
Conflicting connection valuesTwo composite connection blocks set the same key to different values
Non-string connection valueA connection detail value is not a base64-encoded string

Requirement Errors

ErrorDescription
Both matchName and matchLabelsA requirement block specifies both selection methods
Neither matchName nor matchLabelsA requirement block specifies no selection method
Type mismatchData type mismatch in select attributes

Function Errors

ErrorDescription
Invalid function nameA function or arg has a name that is not a valid identifier
Unknown functioninvoke references a non-existent function
Bad invocationinvoke called with missing required arguments or unrecognized argument names
Stack overflowCall stack exceeds 100 frames (infinite recursion protection)

Context Errors

ErrorDescription
Conflicting context valuesTwo context blocks write different non-object values to the same key path
Last modified March 12, 2026: clean up docs, mostly (1ee88e8)