infiniflow/ragflow · error · CredentialExpiredError
Invalid or expired Confluence credentials (HTTP 401).
Error message
Invalid or expired Confluence credentials (HTTP 401).
What it means
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.
Source
Thrown at common/data_source/confluence_connector.py:1842
if len(doc_metadata_list) > _SLIM_DOC_BATCH_SIZE:
yield doc_metadata_list[:_SLIM_DOC_BATCH_SIZE]
doc_metadata_list = doc_metadata_list[_SLIM_DOC_BATCH_SIZE:]
if callback and callback.should_stop():
raise RuntimeError("retrieve_all_slim_docs_perm_sync: Stop signal detected")
if callback:
callback.progress("retrieve_all_slim_docs_perm_sync", 1)
yield doc_metadata_list
def validate_connector_settings(self) -> None:
try:
spaces = self.low_timeout_confluence_client.get_all_spaces(limit=1)
except HTTPError as e:
status_code = e.response.status_code if e.response else None
if status_code == 401:
raise CredentialExpiredError("Invalid or expired Confluence credentials (HTTP 401).")
elif status_code == 403:
raise InsufficientPermissionsError("Insufficient permissions to access Confluence resources (HTTP 403).")
raise UnexpectedValidationError(f"Unexpected Confluence error (status={status_code}): {e}")
except Exception as e:
raise UnexpectedValidationError(f"Unexpected error while validating Confluence settings: {e}")
if self.space:
try:
self.low_timeout_confluence_client.get_space(self.space)
except ApiError as e:
raise ConnectorValidationError("Invalid Confluence space key provided") from e
if not spaces or not spaces.get("results"):
raise ConnectorValidationError("No Confluence spaces found. Either your credentials lack permissions, or there truly are no spaces in this Confluence instance.")
if __name__ == "__main__":
import osView on GitHub (pinned to 554fb1133a)
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
Defensive patterns
Strategy: try-catch
Try / catch
try:
connector.validate_connector_settings()
except CredentialExpiredError:
# surface to user: re-enter Confluence credentials
notify_user('Confluence credentials expired or invalid; please update the API token') Prevention
- Store Confluence tokens in a secret manager with rotation reminders
- Run validate_connector_settings after every credential change and on a schedule
When it happens
Trigger: 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).
Common situations: Atlassian rotated/scoped API tokens; email/username change; tenant migrated between cloud and data center; token pasted with whitespace or truncated.
Understand the failure class
- HTTP status errors: handling 4xx and 5xx responses — how to handle 4xx and 5xx responses properly.
Related errors
- Unsupported type: {channel_type}
- Missing issuer in configuration.
- Error parsing ID Token: {e}
- Insufficient permissions to access Confluence resources (HTT
- Unexpected error while validating Confluence settings: {e}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/cbb280f31db7b813.
Report an issue: GitHub.