Skip to content

UI initialization fails with "TypeError: Failed to fetch" when api.motherduck.com is unreachable #229

@moussadiakitesodexocom

Description

@moussadiakitesodexocom

Summary

The DuckDB UI fails to initialize when api.motherduck.com and auth.motherduck.com
are unreachable (e.g., blocked by a corporate firewall), even though the documentation
states that MotherDuck is opt-in and queries run fully locally by default.

Environment

  • DuckDB version: v1.4.4 (Andium)
  • OS: Ubuntu / Linux (Azure VM, corporate environment)
  • Browser: Chrome
  • ui.duckdb.org: accessible ✓
  • api.motherduck.com: unreachable (TCP timeout on port 443) ✗
  • auth.motherduck.com: unreachable (TCP timeout on port 443) ✗

Steps to reproduce

  1. Run duckdb src/dev.duckdb -ui in an environment where
    api.motherduck.com and auth.motherduck.com are blocked by a firewall.
  2. Open http://localhost:4213 in a browser.

Actual behavior

The UI shows an initialization error immediately:

Initialization Error
Please reload, if the problem persists, reach out on Slack or support@motherduck.com

Error Details: Failed to resolve app state with user - TypeError: Failed to fetch
Username: unknown
User E-mail: unknown

The error occurs because the JavaScript app makes a fetch() call to
api.motherduck.com on startup. When the request times out (~10s), the
uncaught network error crashes the initialization flow entirely.

Expected behavior

Since MotherDuck is opt-in and the UI is documented as running fully locally
by default, the app should gracefully handle the case where MotherDuck's API
is unreachable — for example, by catching the fetch error and continuing in
local-only mode instead of blocking initialization.

Suggested fix

Wrap the MotherDuck session check in a try/catch (or use Promise.race with
a short timeout), and fall back to anonymous local mode if the request fails
or times out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs infoMore investigation is required to understand this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions