n8n-io/n8n · error · NodeOperationError
Authorization failed - insufficient permissions.
Error message
Authorization failed - insufficient permissions.
What it means
In the same connection catch block, an error whose message contains '403' or 'Forbidden' is reclassified as an authorization NodeOperationError. The API key is valid but lacks the permission level required for the connection-time operation (e.g. listing/creating an index).
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreAzureAISearch/VectorStoreAzureAISearch.node.ts:312
if (
error.message?.includes('401') ||
error.message?.includes('Unauthorized') ||
error.message?.includes('authentication failed')
) {
throw new NodeOperationError(
context.getNode(),
'Authentication failed - invalid API key or endpoint.',
{
itemIndex,
description:
'Please verify your API Key and Search Endpoint are correct in the credentials configuration.',
},
);
}
// Check for authorization errors (403)
if (error.message?.includes('403') || error.message?.includes('Forbidden')) {
throw new NodeOperationError(
context.getNode(),
'Authorization failed - insufficient permissions.',
{
itemIndex,
description:
'The API Key does not have sufficient permissions. Ensure the key has the required access level for this operation.',
},
);
}
const errorMessage = error instanceof Error ? error.message : String(error);
throw new NodeOperationError(context.getNode(), `Error: ${errorMessage}`, {
itemIndex,
description: 'Please check your Azure AI Search connection details',
});
}
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Switch the credential to an admin key for operations that create/modify the index.
- In Azure, verify the key's permissions and any IP/firewall/network rules.
- If using RBAC, assign the required Search Service Contributor / Search Index Data Contributor roles.
Defensive patterns
Strategy: validation
Validate before calling
// Determine whether the operation needs admin rights and require an admin-key-flagged credential.
const needsAdmin = operation === 'createIndex' || operation === 'deleteIndex';
if (needsAdmin && !cred.isAdminKey) throw new Error('This operation requires an admin key.'); Prevention
- Use admin keys only for index-management operations; document which operations need them.
- If using RBAC, pre-validate role assignments for the principal.
When it happens
Trigger: Error during client init/index access with error.message containing '403' or 'Forbidden' — typically because a query (read-only) key is used for an operation that needs admin rights.
Common situations: A query key was supplied where the node needs to create or inspect the index (admin-only); Azure RBAC role assignments missing for the principal; key restricted by IP/firewall rules.
Related errors
- Authorization failed - insufficient permissions for document
- Authentication failed - invalid API key or endpoint.
- Parameter ${key} must be a string
- Azure AI Search endpoint is missing or invalid
- API Key is required for authentication
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/bedf52eda84dab35.
Report an issue: GitHub.