err:unkey:application:precondition_failedExample
What Happened?
This error occurs when your request is valid, but a precondition required to fulfill it is not met. Unlike validation errors where your input is invalid, precondition failures indicate that the system or resource is not configured correctly to handle your request. Common scenarios that trigger this error:- API not configured for keys: The API you’re trying to create keys for doesn’t have key authentication set up
- Vault not configured: You’re trying to create recoverable keys or decrypt keys, but the vault service isn’t set up for your workspace
- Encryption not enabled: You’re requesting key encryption/decryption on an API that doesn’t have encryption enabled
- Rate limit configuration missing: You’re checking a rate limit that doesn’t exist for the key or its associated identity
How To Fix
The fix depends on which precondition failed. Check the error’sdetail field for specific information:
Vault Not Set Up
If you see “Vault hasn’t been set up”, you have two options:- Configure the vault service for your workspace (contact Unkey support if you need assistance)
- Remove the encryption requirement from your request:
API Not Set Up for Keys
If you see “The requested API is not set up to handle keys”, you need to:- Verify the API ID is correct
- Ensure the API has key authentication configured in your Unkey dashboard
- Create or configure the key authentication settings for your API
API Not Set Up for Encryption
If you see “This API does not support key encryption”, either:- Enable encrypted key storage for the API in your Unkey dashboard settings
- Remove the
recoverable: trueoption ordecrypt: trueparameter from your request
Rate Limit Not Found
If you see a message about a requested rate limit not existing:- Verify the rate limit name is correct
- Create the rate limit configuration for the key or its identity
- Ensure the rate limit is associated with the correct resource
Common Mistakes
- Assuming features are enabled by default: Features like vault encryption and rate limits require explicit configuration
- Wrong API configuration: Trying to use encryption features on an API that wasn’t set up for it
- Missing rate limit setup: Referencing rate limits that haven’t been created yet
- Workspace-level configuration issues: Some features need to be enabled at the workspace level before they can be used
Related Errors
- err:unkey:application:invalid_input - When your request input fails validation
- err:unkey:data:api_not_found - When the API itself doesn’t exist
- err:unkey:application:service_unavailable - When a required service is temporarily unavailable