lfnovo/open-notebook · error · ValueError

Invalid URL scheme: '{parsed.scheme}'. Only http and https a

Error message

Invalid URL scheme: '{parsed.scheme}'. Only http and https are allowed.

What it means

Error "Invalid URL scheme: '{parsed.scheme}'. Only http and https are allowed." thrown in lfnovo/open-notebook.

Source

Thrown at open_notebook/utils/url_validation.py:73

    - AWS's IPv6 metadata address (fd00:ec2::254)
    - Hostnames that resolve to any of the above

    Args:
        url: The URL to validate
        provider: The provider name (for logging/context)

    Raises:
        ValueError: If the URL is invalid
    """
    if not url or not url.strip():
        return  # Empty URLs handled elsewhere

    try:
        parsed = urlparse(url.strip())

        # Validate scheme - only http/https allowed
        if parsed.scheme not in ("http", "https"):
            raise ValueError(
                f"Invalid URL scheme: '{parsed.scheme}'. Only http and https are allowed."
            )

        # Extract hostname
        hostname = parsed.hostname
        if not hostname:
            raise ValueError("Invalid URL: hostname could not be determined.")

        # Try to parse as IP address to check for dangerous addresses
        try:
            ip = ipaddress.ip_address(hostname)
            _reject_dangerous_ip(ip, hostname)

        except ValueError as ve:
            # Re-raise our own ValueErrors
            if "Link-local" in str(ve) or "Invalid URL" in str(ve) or "metadata" in str(ve):
                raise
            # Not an IP address, it's a hostname - need to resolve and check

View on GitHub (pinned to a7de90d38a)

When it happens

Trigger: Thrown at open_notebook/utils/url_validation.py:73 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27). Data as JSON: /api/errors/3361a440c1c35a1c. Report an issue: GitHub.