mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Add error handling for missing gitlab_webhook table
Adds defensive error handling in install_gitlab_webhooks.py to catch table not found errors and provide clear, actionable error messages. Root Cause: - Migration 027 created table as 'gitlab-webhook' (with hyphen) - SQLAlchemy model expects 'gitlab_webhook' (with underscore) - Migration 032 fixes this but may not be applied in all environments This change: - Catches UndefinedTableError when querying gitlab_webhook table - Logs clear error message indicating migration 032 is needed - Returns gracefully to prevent continuous error logging - Provides actionable guidance: 'alembic upgrade head' Impact: - Prevents cronjob from crashing repeatedly in Datadog - Makes it immediately clear to operators what action is needed - Reduces noise in error logs Fixes error seen in Datadog logs since Oct 13, 2025: relation "gitlab_webhook" does not exist Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
parent
fab64a51b7
commit
551e31b84d
@ -262,7 +262,24 @@ class VerifyWebhookStatus:
|
||||
webhook_store = await GitlabWebhookStore.get_instance()
|
||||
|
||||
# Load chunks of rows that need processing (webhook_exists == False)
|
||||
webhooks_to_process = await self.fetch_rows(webhook_store)
|
||||
try:
|
||||
webhooks_to_process = await self.fetch_rows(webhook_store)
|
||||
except Exception as e:
|
||||
# Check if this is a table not found error (likely due to missing migration)
|
||||
if 'does not exist' in str(e) and ('gitlab_webhook' in str(e) or 'gitlab-webhook' in str(e)):
|
||||
logger.error(
|
||||
'gitlab_webhook table does not exist. This usually means database migration 032 '
|
||||
'or later has not been applied. Please run database migrations: alembic upgrade head',
|
||||
extra={
|
||||
'error_type': type(e).__name__,
|
||||
'error_message': str(e),
|
||||
'migration_needed': '032_add_status_column_to_gitlab_webhook.py',
|
||||
},
|
||||
)
|
||||
# Return early to avoid continuous error logging
|
||||
return
|
||||
# Re-raise other exceptions
|
||||
raise
|
||||
|
||||
logger.info(
|
||||
'Processing webhook chunks',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user