infiniflow/ragflow · error · UnexpectedValidationError

Unexpected error while validating Bitbucket settings: {e}

Error message

Unexpected error while validating Bitbucket settings: {e}

What it means

The outer except in validation wraps any exception that is not one of the known connector error types (CredentialExpiredError, InsufficientPermissionsError, UnexpectedValidationError, ConnectorMissingCredentialError) as UnexpectedValidationError with the original error text.

Source

Thrown at common/data_source/bitbucket/connector.py:316

                if resp.status_code == 401:
                    raise CredentialExpiredError("Invalid or expired Bitbucket credentials (HTTP 401).")
                if resp.status_code == 403:
                    raise InsufficientPermissionsError("Insufficient permissions to access Bitbucket workspace (HTTP 403).")
                if resp.status_code < 200 or resp.status_code >= 300:
                    raise UnexpectedValidationError(f"Unexpected Bitbucket error (status={resp.status_code}).")
        except Exception as e:
            # Network or other unexpected errors
            if isinstance(
                e,
                (
                    CredentialExpiredError,
                    InsufficientPermissionsError,
                    UnexpectedValidationError,
                    ConnectorMissingCredentialError,
                ),
            ):
                raise
            raise UnexpectedValidationError(f"Unexpected error while validating Bitbucket settings: {e}")


if __name__ == "__main__":
    bitbucket = BitbucketConnector(workspace="<YOUR_WORKSPACE>")

    bitbucket.load_credentials(
        {
            "bitbucket_email": "<YOUR_EMAIL>",
            "bitbucket_api_token": "<YOUR_API_TOKEN>",
        }
    )

    bitbucket.validate_connector_settings()
    print("Credentials validated successfully.")

    start_time = datetime.fromtimestamp(0, tz=timezone.utc)
    end_time = datetime.now(timezone.utc)

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Read the embedded {e} to identify network vs TLS vs proxy causes
  2. Verify connectivity: curl -I https://api.bitbucket.org/2.0/ from the same host/env
  3. Configure proxy env vars or trust store appropriately, then re-validate
Defensive patterns

Strategy: retry

Validate before calling

import socket
try:
    socket.create_connection(("api.bitbucket.org", 443), timeout=5)
except OSError as e:
    raise RuntimeError(f"cannot reach Bitbucket API: {e}")

Try / catch

try:
    conn.validate_connector_settings()
except UnexpectedValidationError as e:
    if is_transient_network_error(str(e)):  # DNS, connect, TLS, timeout keywords
        schedule_retry_with_backoff()
    else:
        log_full_inner_error_and_alert()  # inspect wrapped {e} text
        raise

Prevention

When it happens

Trigger: httpx.ConnectError/ConnectTimeout (DNS, proxy, offline), TLS certificate failures, or bugs raising arbitrary exceptions inside the try block.

Common situations: Corporate proxies blocking api.bitbucket.org; misconfigured HTTP_PROXY/HTTPS_PROXY; air-gapped CI runners; IPv6/DNS flakes.

Related errors


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