{"record":{"id":"b2e58b1c64e6f0d5","repo":"infiniflow/ragflow","slug":"confluence","errorCode":null,"errorMessage":"Confluence","messagePattern":"Confluence","errorType":"validation","errorClass":"ConnectorMissingCredentialError","httpStatus":null,"severity":"error","filePath":"common/data_source/confluence_connector.py","lineNumber":1278,"sourceCode":"\n    def _adjust_start_for_query(self, start: SecondsSinceUnixEpoch | None) -> SecondsSinceUnixEpoch | None:\n        if not start or start <= 0:\n            return start\n        if self.time_buffer_seconds <= 0:\n            return start\n        return max(0.0, start - self.time_buffer_seconds)\n\n    def _is_newer_than_start(self, doc_time: datetime | None, start: SecondsSinceUnixEpoch | None) -> bool:\n        if not start or start <= 0:\n            return True\n        if doc_time is None:\n            return True\n        return doc_time.timestamp() > start\n\n    @property\n    def confluence_client(self) -> OnyxConfluence:\n        if self._confluence_client is None:\n            raise ConnectorMissingCredentialError(\"Confluence\")\n        return self._confluence_client\n\n    @property\n    def low_timeout_confluence_client(self) -> OnyxConfluence:\n        if self._low_timeout_confluence_client is None:\n            raise ConnectorMissingCredentialError(\"Confluence\")\n        return self._low_timeout_confluence_client\n\n    def set_credentials_provider(self, credentials_provider: CredentialsProviderInterface) -> None:\n        self.credentials_provider = credentials_provider\n\n        # raises exception if there's a problem\n        confluence_client = OnyxConfluence(\n            is_cloud=self.is_cloud,\n            url=self.wiki_base,\n            credentials_provider=credentials_provider,\n            scoped_token=self.scoped_token,\n        )","sourceCodeStart":1260,"sourceCodeEnd":1296,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/confluence_connector.py#L1260-L1296","documentation":"Raised by the ConfluenceConnector.confluence_client property when self._confluence_client is None, i.e. _initialize_connection was never run or failed before building the client. The connector keeps two clients (a normal one and a low-timeout one for cheap calls); both properties raise ConnectorMissingCredentialError('Confluence') on the same not-initialized condition. Any code touching the property before initialization hits this.","triggerScenarios":"Accessing connector.confluence_client (directly or via methods that fetch spaces/pages) before _initialize_connection completed; a failed credential load (bad API token / expired OAuth) leaving both clients None; using a connector after a re-initialization error.","commonSituations":"Building ConfluenceConnector and immediately exercising it in tests without set_credentials_provider + _initialize_connection; an indexing run whose credential provider raised (e.g. expired Atlassian API token) with the error swallowed, then later code touches confluence_client; ordering bugs in orchestrators that poll before connecting.","solutions":["Run the full initialization sequence before any use: set_credentials_provider(provider) then _initialize_connection(...) (it renews credentials and builds both clients)","Verify the Atlassian credentials up front — email + API token for cloud, PAT for server — so _initialize_connection does not fail midway","Do not catch-and-continue on errors from _initialize_connection; the connector is unusable without its clients","In tests, stub set_credentials_provider with a fake provider and call _initialize_connection before assertions that touch the client"],"exampleFix":"// before\nconnector = ConfluenceConnector(...)\nspaces = connector.confluence_client.get_all_spaces()  # raises\n// after\nconnector = ConfluenceConnector(...)\nconnector.set_credentials_provider(provider)\nconnector._initialize_connection()\nspaces = connector.confluence_client.get_all_spaces()","handlingStrategy":"validation","validationCode":"connector.set_credentials_provider(provider)\nconnector._initialize_connection()\nif connector._confluence_client is None:\n    raise RuntimeError('Confluence client failed to initialize — check credentials')","typeGuard":"def is_confluence_ready(c: ConfluenceConnector) -> bool:\n    return c._confluence_client is not None and c._low_timeout_confluence_client is not None","tryCatchPattern":"from common.data_source.exceptions import ConnectorMissingCredentialError\ntry:\n    client = connector.confluence_client\nexcept ConnectorMissingCredentialError:\n    connector.set_credentials_provider(provider)\n    connector._initialize_connection()\n    client = connector.confluence_client","preventionTips":["Encapsulate the full lifecycle (set_credentials_provider + _initialize_connection) in one setup helper called before any document fetch","Validate Atlassian credentials (cloud: email + API token; server: PAT) before initialization so _initialize_connection cannot fail halfway and leave clients None"],"tags":["confluence","credentials","lifecycle","initialization"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}