Snowflake Cortex AI Functions: Multirow error handling for AI_ EMBED and AI_ SIMILARITY (Pending)¶
Attention
This behavior change is in the 2026_06 bundle.
For the current status of the bundle, refer to Bundle history.
When this behavior change bundle is enabled, AI_EMBED and AI_SIMILARITY return NULL on non-fatal errors rather than raising the error. This allows multi-row queries to complete even if some rows have errors. This change is a continuation of the multirow error handling improvements in BCR-2184.
- Before the change:
AI_EMBED and AI_SIMILARITY raised an error when the function did not succeed.
- After the change:
When the 2026_06 behavior change bundle is enabled in your account, AI_EMBED and AI_SIMILARITY return NULL when the function does not succeed, allowing multi-row queries to complete when some rows cannot be processed. Rows with errors can easily be excluded from multi-row results.
A new, optional final parameter,
return_error_details, when present and set to TRUE, causes the functions to return a typed OBJECT withvalueanderrorfields rather than the former result type:- AI_EMBED:
OBJECT(value VECTOR, error STRING) - AI_SIMILARITY:
OBJECT(value FLOAT, error STRING)
If the function succeeded, the
errorfield is NULL and thevaluefield contains the actual return value. If the function failed, thevaluefield is NULL and theerrorfield contains an error message. In addition to allowing rows with errors to be easily excluded from multi-row results, this behavior allows errors to be recorded for later review.Fatal errors still cause the query to fail.
- AI_EMBED:
Ref: 2358