arduino/Arduino · error · InvalidSchema

No connection adapters were found for '%s'

Error message

No connection adapters were found for '%s'

What it means

Session.get_adapter() selects a transport adapter by matching the URL against registered adapter prefixes (default 'https://' and 'http://'). If no registered prefix matches the URL's beginning, it raises InvalidSchema — the scheme is unknown or unregistered.

Source

Thrown at arduino-core/src/processing/app/i18n/python/requests/sessions.py:450

        # Shuffle things around if there's history.
        if history:
            # Insert the first (original) request at the start
            history.insert(0, r)
            # Get the last request made
            r = history.pop()
            r.history = tuple(history)

        return r

    def get_adapter(self, url):
        """Returns the appropriate connnection adapter for the given URL."""
        for (prefix, adapter) in self.adapters.items():

            if url.startswith(prefix):
                return adapter

        # Nothing matches :-/
        raise InvalidSchema("No connection adapters were found for '%s'" % url)

    def close(self):
        """Closes all adapters and as such the session"""
        for _, v in self.adapters.items():
            v.close()

    def mount(self, prefix, adapter):
        """Registers a connection adapter to a prefix."""
        self.adapters[prefix] = adapter

    def __getstate__(self):
        return dict((attr, getattr(self, attr, None)) for attr in self.__attrs__)

    def __setstate__(self, state):
        for attr, value in state.items():
            setattr(self, attr, value)

View on GitHub (pinned to a0df6e0e83)

Solutions

  1. Ensure the URL includes the scheme: prefix with 'https://' or 'http://'.
  2. For custom schemes, mount an adapter: session.mount('myapp://', MyAdapter()).
  3. Fix env/config URLs (HTTP_PROXY, base_url settings) that are missing the scheme.
  4. Check for typos in the scheme before dispatching.

Example fix

// before
s.get('example.com/api')  # InvalidSchema: no adapter matches
// after
s.get('https://example.com/api')
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlparse
def ensure_adaptable(session, url):
    scheme = urlparse(url).scheme
    if not scheme:
        raise ValueError('URL missing scheme: %r' % url)
    if not any(url.startswith(p) for p in session.adapters):
        raise ValueError('No adapter for scheme %r (mounted: %s)' % (scheme, list(session.adapters)))

Try / catch

from requests.exceptions import InvalidSchema
try:
    resp = session.get(url, timeout=10)
except InvalidSchema as e:
    log.error('Unsupported URL scheme: %s', e)
    raise ValueError('Use http(s):// or mount a custom adapter') from e

Prevention

When it happens

Trigger: Calling session.send/prepared requests with schemes like 'ftp://', 'file://', 'unix://', or a URL missing its scheme entirely ('example.com/api') so no 'http://' prefix matches; custom adapters removed or a session constructed without default adapters (e.g. via mount manipulation).

Common situations: Connecting through unix sockets/custom schemes without mounting an adapter; malformed URLs from config/env missing the scheme; typos like 'htp://'; using Session after Session.close() or clearing self.adapters.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of arduino/Arduino@a0df6e0e83 (2026-09-06). Data as JSON: /api/errors/2196d88a7ef2c50d. Report an issue: GitHub.