{"record":{"id":"bedf52eda84dab35","repo":"n8n-io/n8n","slug":"authorization-failed-insufficient-permissions","errorCode":null,"errorMessage":"Authorization failed - insufficient permissions.","messagePattern":"Authorization failed - insufficient permissions\\.","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreAzureAISearch/VectorStoreAzureAISearch.node.ts","lineNumber":312,"sourceCode":"\t\tif (\n\t\t\terror.message?.includes('401') ||\n\t\t\terror.message?.includes('Unauthorized') ||\n\t\t\terror.message?.includes('authentication failed')\n\t\t) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Authentication failed - invalid API key or endpoint.',\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Please verify your API Key and Search Endpoint are correct in the credentials configuration.',\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Check for authorization errors (403)\n\t\tif (error.message?.includes('403') || error.message?.includes('Forbidden')) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Authorization failed - insufficient permissions.',\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'The API Key does not have sufficient permissions. Ensure the key has the required access level for this operation.',\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\tthrow new NodeOperationError(context.getNode(), `Error: ${errorMessage}`, {\n\t\t\titemIndex,\n\t\t\tdescription: 'Please check your Azure AI Search connection details',\n\t\t});\n\t}\n}\n","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreAzureAISearch/VectorStoreAzureAISearch.node.ts#L294-L330","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Determine whether the operation needs admin rights and require an admin-key-flagged credential.\nconst needsAdmin = operation === 'createIndex' || operation === 'deleteIndex';\nif (needsAdmin && !cred.isAdminKey) throw new Error('This operation requires an admin key.');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use admin keys only for index-management operations; document which operations need them.","If using RBAC, pre-validate role assignments for the principal."],"tags":["azure-ai-search","vector-store","authorization","error-classification","http-403"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}