{"record":{"id":"3baf557223632ce8","repo":"n8n-io/n8n","slug":"authorization-failed-insufficient-permissions-fo","errorCode":null,"errorMessage":"Authorization failed - insufficient permissions for document upload.","messagePattern":"Authorization failed - insufficient permissions for document upload\\.","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreAzureAISearch/VectorStoreAzureAISearch.node.ts","lineNumber":523,"sourceCode":"\t\t\t) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tcontext.getNode(),\n\t\t\t\t\t'Authentication failed during document upload - invalid API key or endpoint.',\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\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\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Check for authorization errors\n\t\t\tif (\n\t\t\t\terror.message?.includes('403') ||\n\t\t\t\terror.message?.includes('Forbidden') ||\n\t\t\t\t(error as any).statusCode === 403\n\t\t\t) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tcontext.getNode(),\n\t\t\t\t\t'Authorization failed - insufficient permissions for document upload.',\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'The API Key does not have sufficient permissions for write operations. Ensure the key has the required access level.',\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Check for RestError (common Azure SDK error)\n\t\t\tif ((error as any).name === 'RestError' || error.message?.includes('RestError')) {\n\t\t\t\tconst statusCode = (error as any).statusCode || 'unknown';\n\t\t\t\tconst errorCode = (error as any).code || 'unknown';\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tcontext.getNode(),\n\t\t\t\t\t`Azure AI Search API error (${statusCode}): ${errorMessage}`,","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreAzureAISearch/VectorStoreAzureAISearch.node.ts#L505-L541","documentation":"The populateVectorStore catch block reclassifies errors whose message contains '403'/'Forbidden' or whose statusCode === 403 as an authorization NodeOperationError tailored to writes. The key is valid but cannot perform write/insert operations.","triggerScenarios":"vectorStore.addDocuments fails with an error matching '403'/'Forbidden' or error.statusCode === 403 — a read-only query key used to insert documents.","commonSituations":"A query key (read-only) was supplied for the insert/load-documents operation; Azure RBAC roles do not include write access; the index is in read-only mode.","solutions":["Use an admin key (or a key with write permission) for document upload.","Grant Search Index Data Contributor via Azure RBAC if using role-based access.","Confirm the target index is not in read-only/consuming state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Require a write-capable key for populateVectorStore.\nconst cred = await getValidatedCredentials(context, itemIndex);\nif (!cred.isAdminKey) throw new Error('Document upload requires an admin/write-capable Azure AI Search key.');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not use read-only query keys for ingest workflows.","Annotate the credential with whether it is admin or query to enforce correct usage."],"tags":["azure-ai-search","vector-store","authorization","document-upload","http-403"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}