{"record":{"id":"5bb8b74a479d7695","repo":"infiniflow/ragflow","slug":"invalid-confluence-space-key-provided","errorCode":null,"errorMessage":"Invalid Confluence space key provided","messagePattern":"Invalid Confluence space key provided","errorType":"validation","errorClass":"ConnectorValidationError","httpStatus":null,"severity":"error","filePath":"common/data_source/confluence_connector.py","lineNumber":1853,"sourceCode":"\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\n\n    # base url\n    wiki_base = os.environ[\"CONFLUENCE_URL\"]\n\n    # auth stuff\n    username = os.environ[\"CONFLUENCE_USERNAME\"]\n    access_token = os.environ[\"CONFLUENCE_ACCESS_TOKEN\"]\n    is_cloud = os.environ[\"CONFLUENCE_IS_CLOUD\"].lower() == \"true\"\n\n    # space + page\n    space = os.environ[\"CONFLUENCE_SPACE_KEY\"]","sourceCodeStart":1835,"sourceCodeEnd":1871,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/confluence_connector.py#L1835-L1871","documentation":"Raised by validate_connector_settings() when the connector was configured with a specific space key but get_space(self.space) throws an ApiError. This means the spaces list endpoint worked, but the configured key does not resolve — wrong key, renamed space, or a space the token cannot see. Chained 'from e' so the original ApiError is preserved.","triggerScenarios":"Space key typed with wrong case ('Eng' vs 'ENG'), trailing whitespace, a space that was renamed/deleted, or a key the credentials cannot access so the API reports it as not found.","commonSituations":"Keys copied from the UI URL vs the actual key field; space keys changed during reorganizations; data-center vs cloud key format confusion.","solutions":["Copy the space key exactly from Space Settings > Space details (keys are case-sensitive)","Trim whitespace/newlines from the connector config field","Call get_all_spaces with the same credentials and confirm the key appears in the results","If the space was renamed, update the connector config to the new key"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"spaces = low_timeout_client.get_all_spaces(limit=100)\nkeys = {s['key'] for s in spaces.get('results', [])}\nif configured_space not in keys:\n    raise ValueError(f'space key {configured_space!r} not in {keys}')","typeGuard":null,"tryCatchPattern":"try:\n    connector.validate_connector_settings()\nexcept ConnectorValidationError as e:\n    if 'space key' in str(e):\n        # re-prompt for the space key, listing valid keys\n        ...","preventionTips":["Populate space-key fields from get_all_spaces results instead of free-text entry","Trim and case-normalize space key input in the config UI"],"tags":["confluence","config","validation","space-key"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}