infiniflow/ragflow · error · ConnectorValidationError
Unexpected error during Box settings validation: {e}
Error message
Unexpected error during Box settings validation: {e} What it means
Raised by BoxConnector.validate_connector_settings as the generic failure branch: the credential probe self.box_client.users.get_user_me() threw an exception, so the connector wraps it in ConnectorValidationError('Unexpected error during Box settings validation: {e}'). The original exception is also logged via logging.exception with tag '[Box]', so the stack trace with the real cause is in the logs. Any Box API error — auth failure, network error, permission restriction — lands here.
Source
Thrown at common/data_source/box_connector.py:37
def __init__(self, folder_id: str, batch_size: int = INDEX_BATCH_SIZE, use_marker: bool = True) -> None:
self.batch_size = batch_size
self.folder_id = "0" if not folder_id else folder_id
self.use_marker = use_marker
self.box_client: BoxClient | None = None
def load_credentials(self, auth: Any):
self.box_client = BoxClient(auth=auth)
return None
def validate_connector_settings(self):
if self.box_client is None:
raise ConnectorMissingCredentialError("Box")
try:
self.box_client.users.get_user_me()
except Exception as e:
logging.exception("[Box]: Failed to validate Box credentials")
raise ConnectorValidationError(f"Unexpected error during Box settings validation: {e}")
def _iter_files_recursive(
self,
folder_id: str,
relative_folder_path: str = "",
) -> Generator[tuple[Any, str], None, None]:
if self.box_client is None:
raise ConnectorMissingCredentialError("Box")
result = self.box_client.folders.get_folder_items(
folder_id=folder_id,
limit=self.batch_size,
usemarker=self.use_marker,
)
while True:
for entry in result.entries:
if entry.type == "file":View on GitHub (pinned to 554fb1133a)
Solutions
- Check the logged '[Box]: Failed to validate Box credentials' exception — it contains the exact Box error (expired token, invalid client credentials, forbidden, etc.)
- If OAuth: ensure the auth object refreshes tokens (refresh token present) and the app still has grant access for the user
- If CCG/JWT: verify client_id, client_secret, enterprise_id, and the private key match the current Box console values
- Confirm network access to https://api.box.com from the indexing host
Defensive patterns
Strategy: try-catch
Validate before calling
try:
me = connector.box_client.users.get_user_me()
except Exception as e:
log.exception('Box probe failed: %s', e) # inspect real cause before wrapping
raise
connector.validate_connector_settings() Try / catch
from common.data_source.exceptions import ConnectorValidationError
try:
connector.validate_connector_settings()
except ConnectorValidationError as e:
cause = str(e)
if 'invalid_grant' in cause or 'expired' in cause.lower():
refresh_oauth_token_and_retry()
elif 'Forbidden' in cause or 'access_denied' in cause:
alert_ops('Box app not authorized for this enterprise')
else:
raise Prevention
- Keep the '[Box]: Failed to validate Box credentials' log line searchable — the wrapped message alone hides the Box error kind
- For CCG, re-verify enterprise_id/client_secret after any Box app re-authorization; for OAuth, wire token refresh before running validation
When it happens
Trigger: get_user_me() failing: expired/invalid OAuth access token (invalid_request/expired_token), CCG/JWT misconfiguration (wrong enterprise id, bad private key, unauthorized app), network unreachable to api.box.com, or the Box app's access level restricting the users scope.
Common situations: OAuth access token expired and no refresh flow wired up (Box tokens last 60 minutes); CCG auth with enterprise_id unset; Box Platform app not authorized for the enterprise; corporate firewall blocking api.box.com; JWT keypair regenerated in the Box console but the old key still configured.
Related errors
- main() must be defined or exported.
- Unsupported type: {channel_type}
- Azure Blob credential rejected: {msg[:300]}
- Bitbucket
- Provided blob storage credentials appear invalid or expired.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/a051eccb51b90ff1.
Report an issue: GitHub.