Troubleshoot budgets

The following scenarios can help you troubleshoot issues that can occur when creating or editing budgets:

You can’t activate the account budget

There are multiple reasons you might be unable to activate your account budget:

Error

Unknown user-defined function SNOWFLAKE.LOCAL.ACTIVATE

Cause

If your Snowflake account is new, the account budget is not yet available in your account.

Solution

Wait for the account budget to be available in your newly created account. You can activate it after it becomes available.

Error

FAILURE: Uncaught exception of type 'BUDGET_ALREADY_ACTIVATED' on line X at position X

Cause

The account budget has already been activated.

Solution

You can call the <budget_name>!GET_CONFIG method to view the activation timestamp:

CALL SNOWFLAKE.LOCAL.ACCOUNT_ROOT_BUDGET!GET_CONFIG();
Copy

Error

-20000 (P0001): Uncaught exception of type 'NO_PERMISSION_TO_ACTIVATE_BUDGET' on line X at position X

Cause

Your account does not yet support the Budgets feature.

Solution

The Budgets feature is not available for accounts in Gov regions. Support for Gov regions will be available in a future release.

You can’t create a custom budget

There are multiple reasons you might be unable to create a custom budget.

Error

FAILURE: SQL access control error: Insufficient privileges to operate on class 'BUDGET'

Cause

The role you are using does not have the privileges required to create custom budgets.

Solution

Use a role with the required privileges. See Create a custom role to create budgets.

Error

FAILURE: Uncaught exception of type 'STATEMENT_ERROR' on line 0 at position -1 :
Uncaught exception of type 'UNSUPPORTED_BUDGET_TYPE' on line X at position X

Cause

You pass arguments to the constructor method to create a budget.

Solution

See CREATE BUDGET and edit your create statement.

You can’t activate a custom budget

Error

FAILURE: Uncaught exception of type 'STATEMENT_ERROR' on line 0 at position -1 :
Uncaught exception of type 'UNSUPPORTED_BUDGET_TYPE' on line X at position X

Cause

You tried to call the ACTIVATE method on a custom budget.

Solution

The ACTIVATE method is only available on the account budget. After you have created a custom budget, use the <budget_name>!SET_SPENDING_LIMIT and <budget_name>!SET_EMAIL_NOTIFICATIONS methods to configure the budget and start receiving notification emails.

You can’t call methods on the account budget

There are multiple reasons why calling a method on the account budget might fail.

Error

-20000 (P0001): Uncaught exception of type 'FUNCTION_NOT_SUPPORTED_FOR_ACCOUNT_ROOT_BUDGET' on line 11 at position 18

Cause

You tried to call any of the following methods on the account budget:

Solution

These methods are not available on the account budget. The account budget monitors all supported objects in the account and objects cannot be added or removed. For more information, see Account budget and custom budgets.

Error

-20000 (P0001): Uncaught exception of type 'ACCOUNT_ROOT_BUDGET_NOT_ACTIVATED' on line X at position X

Cause

You tried to call a method on the account budget before the account budget is activated.

Solution

Activate the account budget.

You can’t add or remove objects from a custom budget

To successfully add or remove an object from a custom budget, the role used to call the method must have the required privileges and role.

Error

002141 (42601): SQL compilation error:
Unknown user-defined function <budget_db>.<budget_schema>.<budget_name>!ADD_RESOURCE

Cause

The role you used to call the instance method does not have the required privileges to add (or remove) objects from the budget.

Solution

Grant the required instance role and privileges to the role used to call the method. For more information, see Create a custom role to monitor a custom budget.

Error

002003 (02000): SQL compilation error:
<object_type> '<object_name>' does not exist or not authorized.

Cause

You tried to add an object to a custom budget but the role you used to call the method doesn’t have the required privileges.

Solution

To add (or remove) an object from a budget, the role used to call the method must have the APPLYBUDGET privilege on the object. If the parent object is a database or schema, you must also have the USAGE privilege on the database and schema that contain the object.

For more information, see the list of required object privileges.

Error

Uncaught exception of type 'EXPRESSION_ERROR' on line 10 at position 21 :
Privilege 'APPLYBUDGET' is not authorized on the reference object.

Cause

You tried to create a reference for an object without specifying the PRIVILEGE parameter in the SYSTEM$REFERENCE statement.

Solution

Create the reference with the APPLYBUDGET privilege on the object.

Error

505001 (55000): Uncaught exception of type 'EXPRESSION_ERROR' on line 10
at position 21 : Specified object does not exist or not authorized for
the reference.

Cause

There are multiple causes for this error message:

  • You tried to add the SNOWFLAKE database to a custom budget with an inline SYSTEM$REFERENCE statement.

  • You don’t have the required privileges on the object to create a reference for it. The valid reference is required to add the object to a budget.

Solution

You can’t set email notifications for a budget

The following scenarios can help you troubleshoot common issues when calling the <budget_name>!SET_EMAIL_NOTIFICATIONS method.

Error

Unknown user-defined function <database_name>.<schema_name>.<budget_name>.SET_EMAIL_NOTIFICATIONS

Cause

The role you used to set the email notifications for a custom budget does not have the ADMIN instance role.

Solution

Use a role with the required privileges and roles. See the Access control requirements for SET_EMAIL_NOTIFICATIONS.

Error

Integration '<INTEG_NAME>' does not exist or not authorized.

Cause

The notification integration does not exist.

Solution

Use a valid notification integration. For more information, see Create an email notification integration. Include the email addresses for budgets notifications in the ALLOWED_RECIPIENTS list.

Error

FAILURE: Uncaught exception of type 'EXPRESSION_ERROR' on line 16 at position 34 : Following email address(es) are not
allowed by the email integration <INTEGRATION_NAME>: [<email>]

Cause

The email addresses are not included in the notification integration.

Solution

Add the email addresses to the notification integration, or use a notification integration that includes all the email addresses in the ALLOWED_RECIPIENTS list.

Error

Email recipients in the given list at indexes [<index_list>] are not allowed. Either these email addresses are not yet validated
or do not belong to any user in the current account.

Cause

Some or all of the email addresses you tried to add are not validated.

Solution

See Verify the email addresses of the email notification recipients.

You can’t successfully call the GET_SERVICE_TYPE_USAGE method

The following scenarios can help you troubleshoot common issues when calling the <budget_name>!GET_SERVICE_TYPE_USAGE method.

Error

001044 (42P13): SQL compilation error: error line 0 at position -1 Invalid argument types for function 'GET_SERVICE_TYPE_USAGE':
(VARCHAR(X), VARCHAR(X), VARCHAR(X), VARCHAR(X))

Cause

You called the method with invalid arguments or the wrong number of arguments.

Solution

Check that the arguments you use to call the method are valid and that you’ve included all required arguments.

Error

002151 (22023): Uncaught exception of type 'STATEMENT_ERROR' on line 16 at position 23 : SQL compilation error:
[:TIME_DEPART] is not a valid date/time component for function DATE_TRUNC.

Cause

The TIME_DEPART argument is an invalid string.

Solution

Use one of the valid values listed for the TIME_DEPART argument in the reference topic.

Error

100094 (22000): Uncaught exception of type 'STATEMENT_ERROR' on line 16 at position 23 : Unknown timezone: '<invalid_timezone>'

Cause

The USER_TIMEZONE argument is an invalid string.

Solution

Use a valid timezone string. For more information, see the usage notes for GET_SERVICE_TYPE_USAGE.

The Budgets feature is not available for your account

Errors

FAILURE: SQL compilation error: Class 'SNOWFLAKE.CORE.BUDGET' does not exist or not authorized.
000002 (0A000): Uncaught exception of type 'STATEMENT_ERROR' on line 0 at position -1 : Unsupported feature 'TOK_RESOURCE_GROUP'.

Cause

Your account does not yet support the Budgets feature.

Solution

The Budgets feature is not available for accounts in Gov regions. Support for Gov regions will be available in a future release.