Skip to content

bug: FailedToOpenSocket when workspace lacks AI Gateway #116

Closed

Description

@dgokeeffe

Problem

get_gateway_host() auto-constructs an AI Gateway URL from DATABRICKS_WORKSPACE_ID (always set on Databricks Apps) without checking if the gateway actually exists. Workspaces without AI Gateway enabled get a FailedToOpenSocket error from Claude Code (Bun runtime) when it tries to connect to the non-existent host.

The fallback to {DATABRICKS_HOST}/serving-endpoints/anthropic never triggers because the gateway URL is returned unconditionally.

Affected code

  • utils.py:get_gateway_host() — returns unreachable URL without probing
  • All setup scripts (setup_claude.py, setup_codex.py, setup_gemini.py, setup_opencode.py, setup_proxy.py) — inherit the bad URL

Fix

  • Probe auto-discovered gateway URLs with a 2s timeout GET before using them
  • Cache the result in _GATEWAY_RESOLVED env var so subprocesses skip re-probing
  • Add resolve_and_cache_gateway() helper called once at boot

PR: #114

Activity

  1. datasciencemonkey commented on Apr 14, 2026

    @datasciencemonkey
    Owner

    Fixed in #123 (v0.17.1) — AI Gateway URLs are now probed for reachability with a 2s timeout. Workspaces without AI Gateway gracefully fall back to {DATABRICKS_HOST}/serving-endpoints. Credit: @dgokeeffe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions