{"record":{"id":"050d8f6fcd4c8e58","repo":"infiniflow/ragflow","slug":"unexpected-error-while-validating-bitbucket-settin","errorCode":null,"errorMessage":"Unexpected error while validating Bitbucket settings: {e}","messagePattern":"Unexpected error while validating Bitbucket settings: (.+?)","errorType":"validation","errorClass":"UnexpectedValidationError","httpStatus":null,"severity":"error","filePath":"common/data_source/bitbucket/connector.py","lineNumber":316,"sourceCode":"                if resp.status_code == 401:\n                    raise CredentialExpiredError(\"Invalid or expired Bitbucket credentials (HTTP 401).\")\n                if resp.status_code == 403:\n                    raise InsufficientPermissionsError(\"Insufficient permissions to access Bitbucket workspace (HTTP 403).\")\n                if resp.status_code < 200 or resp.status_code >= 300:\n                    raise UnexpectedValidationError(f\"Unexpected Bitbucket error (status={resp.status_code}).\")\n        except Exception as e:\n            # Network or other unexpected errors\n            if isinstance(\n                e,\n                (\n                    CredentialExpiredError,\n                    InsufficientPermissionsError,\n                    UnexpectedValidationError,\n                    ConnectorMissingCredentialError,\n                ),\n            ):\n                raise\n            raise UnexpectedValidationError(f\"Unexpected error while validating Bitbucket settings: {e}\")\n\n\nif __name__ == \"__main__\":\n    bitbucket = BitbucketConnector(workspace=\"<YOUR_WORKSPACE>\")\n\n    bitbucket.load_credentials(\n        {\n            \"bitbucket_email\": \"<YOUR_EMAIL>\",\n            \"bitbucket_api_token\": \"<YOUR_API_TOKEN>\",\n        }\n    )\n\n    bitbucket.validate_connector_settings()\n    print(\"Credentials validated successfully.\")\n\n    start_time = datetime.fromtimestamp(0, tz=timezone.utc)\n    end_time = datetime.now(timezone.utc)\n","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/bitbucket/connector.py#L298-L334","documentation":"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.","triggerScenarios":"httpx.ConnectError/ConnectTimeout (DNS, proxy, offline), TLS certificate failures, or bugs raising arbitrary exceptions inside the try block.","commonSituations":"Corporate proxies blocking api.bitbucket.org; misconfigured HTTP_PROXY/HTTPS_PROXY; air-gapped CI runners; IPv6/DNS flakes.","solutions":["Read the embedded {e} to identify network vs TLS vs proxy causes","Verify connectivity: curl -I https://api.bitbucket.org/2.0/ from the same host/env","Configure proxy env vars or trust store appropriately, then re-validate"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import socket\ntry:\n    socket.create_connection((\"api.bitbucket.org\", 443), timeout=5)\nexcept OSError as e:\n    raise RuntimeError(f\"cannot reach Bitbucket API: {e}\")","typeGuard":null,"tryCatchPattern":"try:\n    conn.validate_connector_settings()\nexcept UnexpectedValidationError as e:\n    if is_transient_network_error(str(e)):  # DNS, connect, TLS, timeout keywords\n        schedule_retry_with_backoff()\n    else:\n        log_full_inner_error_and_alert()  # inspect wrapped {e} text\n        raise","preventionTips":["Configure HTTP(S)_PROXY in corporate networks before validating","Add connect/read timeouts and retry with backoff on httpx transports","Keep the inner exception text in logs — the wrapper hides the stack otherwise"],"tags":["bitbucket","network","wrapped-error","proxy"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}