{"record":{"id":"cbb280f31db7b813","repo":"infiniflow/ragflow","slug":"invalid-or-expired-confluence-credentials-http-40","errorCode":null,"errorMessage":"Invalid or expired Confluence credentials (HTTP 401).","messagePattern":"Invalid or expired Confluence credentials \\(HTTP 401\\)\\.","errorType":"validation","errorClass":"CredentialExpiredError","httpStatus":401,"severity":"error","filePath":"common/data_source/confluence_connector.py","lineNumber":1842,"sourceCode":"\n            if len(doc_metadata_list) > _SLIM_DOC_BATCH_SIZE:\n                yield doc_metadata_list[:_SLIM_DOC_BATCH_SIZE]\n                doc_metadata_list = doc_metadata_list[_SLIM_DOC_BATCH_SIZE:]\n\n                if callback and callback.should_stop():\n                    raise RuntimeError(\"retrieve_all_slim_docs_perm_sync: Stop signal detected\")\n                if callback:\n                    callback.progress(\"retrieve_all_slim_docs_perm_sync\", 1)\n\n        yield doc_metadata_list\n\n    def validate_connector_settings(self) -> None:\n        try:\n            spaces = self.low_timeout_confluence_client.get_all_spaces(limit=1)\n        except HTTPError as e:\n            status_code = e.response.status_code if e.response else None\n            if status_code == 401:\n                raise CredentialExpiredError(\"Invalid or expired Confluence credentials (HTTP 401).\")\n            elif status_code == 403:\n                raise InsufficientPermissionsError(\"Insufficient permissions to access Confluence resources (HTTP 403).\")\n            raise UnexpectedValidationError(f\"Unexpected Confluence error (status={status_code}): {e}\")\n        except Exception as e:\n            raise UnexpectedValidationError(f\"Unexpected error while validating Confluence settings: {e}\")\n\n        if self.space:\n            try:\n                self.low_timeout_confluence_client.get_space(self.space)\n            except ApiError as e:\n                raise ConnectorValidationError(\"Invalid Confluence space key provided\") from e\n\n        if not spaces or not spaces.get(\"results\"):\n            raise ConnectorValidationError(\"No Confluence spaces found. Either your credentials lack permissions, or there truly are no spaces in this Confluence instance.\")\n\n\nif __name__ == \"__main__\":\n    import os","sourceCodeStart":1824,"sourceCodeEnd":1860,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/confluence_connector.py#L1824-L1860","documentation":"Raised by validate_connector_settings() when a probe call to get_all_spaces(limit=1) returns HTTP 401. The Confluence API rejects the attached credentials (bad API token, wrong username/email, expired PAT, or wrong is_cloud auth mode). Wrapped into CredentialExpiredError so callers can force a credential refresh.","triggerScenarios":"User clicks 'Validate' on a Confluence connector in the admin UI with a revoked/rotated API token, a typo'd username, or is_cloud mismatch (Basic auth sent to a data-center instance expecting PAT or vice versa).","commonSituations":"Atlassian rotated/scoped API tokens; email/username change; tenant migrated between cloud and data center; token pasted with whitespace or truncated.","solutions":["Regenerate the Confluence API token at id.atlassian.com and re-enter it with the exact account email","Verify the wiki_base URL and is_cloud flag match the instance type (cloud uses email+token, server/DC uses username+PAT)","Confirm the token has not expired or been revoked by an org admin","curl -u email:token <wiki_base>/rest/api/space?limit=1 to confirm 401 comes from Atlassian, not a proxy"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    connector.validate_connector_settings()\nexcept CredentialExpiredError:\n    # surface to user: re-enter Confluence credentials\n    notify_user('Confluence credentials expired or invalid; please update the API token')","preventionTips":["Store Confluence tokens in a secret manager with rotation reminders","Run validate_connector_settings after every credential change and on a schedule"],"tags":["confluence","auth","http-401","validation"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}