infiniflow/ragflow · error · ConnectorValidationError

Invalid Confluence space key provided

Error message

Invalid Confluence space key provided

What it means

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.

Source

Thrown at common/data_source/confluence_connector.py:1853

    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 os

    # base url
    wiki_base = os.environ["CONFLUENCE_URL"]

    # auth stuff
    username = os.environ["CONFLUENCE_USERNAME"]
    access_token = os.environ["CONFLUENCE_ACCESS_TOKEN"]
    is_cloud = os.environ["CONFLUENCE_IS_CLOUD"].lower() == "true"

    # space + page
    space = os.environ["CONFLUENCE_SPACE_KEY"]

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Copy the space key exactly from Space Settings > Space details (keys are case-sensitive)
  2. Trim whitespace/newlines from the connector config field
  3. Call get_all_spaces with the same credentials and confirm the key appears in the results
  4. If the space was renamed, update the connector config to the new key
Defensive patterns

Strategy: validation

Validate before calling

spaces = low_timeout_client.get_all_spaces(limit=100)
keys = {s['key'] for s in spaces.get('results', [])}
if configured_space not in keys:
    raise ValueError(f'space key {configured_space!r} not in {keys}')

Try / catch

try:
    connector.validate_connector_settings()
except ConnectorValidationError as e:
    if 'space key' in str(e):
        # re-prompt for the space key, listing valid keys
        ...

Prevention

When it happens

Trigger: 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.

Common situations: Keys copied from the UI URL vs the actual key field; space keys changed during reorganizations; data-center vs cloud key format confusion.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/5bb8b74a479d7695. Report an issue: GitHub.