langchain-ai/deepagents · error · ValueError
remote source must be an absolute HTTPS URL
Error message
remote source must be an absolute HTTPS URL
What it means
This ValueError is raised by `_validate_remote_source_url` in deepagents_code/configuration/types.py when a remote source URL fails to parse as an absolute HTTPS URL. The library requires remote provider/config sources to be plain https:// URLs with a hostname so they can be fetched safely and unambiguously; anything else (http, bare hosts, relative paths) is rejected at dataclass construction time via `__post_init__`.
Source
Thrown at libs/code/deepagents_code/configuration/types.py:77
from urllib.parse import urlsplit
if len(source) > REMOTE_SOURCE_MAX_CHARS:
msg = "remote source is too long"
raise ValueError(msg)
if any(char.isspace() or not char.isprintable() for char in source):
msg = "remote source must not contain whitespace or control characters"
raise ValueError(msg)
try:
parsed = urlsplit(source)
except ValueError as exc:
msg = "remote source is not a valid URL"
raise ValueError(msg) from exc
if not source.isascii():
msg = "remote source must contain only ASCII URI characters"
raise ValueError(msg)
if parsed.scheme.lower() != "https" or not parsed.hostname:
msg = "remote source must be an absolute HTTPS URL"
raise ValueError(msg)
if parsed.username is not None or parsed.password is not None:
msg = "remote source must not contain credentials"
raise ValueError(msg)
if parsed.query or parsed.fragment:
msg = "remote source must not contain a query string or fragment"
raise ValueError(msg)
try:
port = parsed.port
except ValueError as exc:
msg = "remote source has an invalid port"
raise ValueError(msg) from exc
host = parsed.hostname.rstrip(".")
netloc = f"[{host}]" if ":" in host else host
if port is not None:
netloc = f"{netloc}:{port}"
return parsed._replace(scheme="https", netloc=netloc).geturl()
View on GitHub (pinned to a1af029e6e)
Solutions
- Use a fully qualified HTTPS URL with a hostname, e.g. 'https://example.com/path/config.toml'
- Add the missing 'https://' scheme if you passed a bare host
- If the server only supports HTTP, serve the source over HTTPS instead; plain HTTP is not accepted
- Verify the value comes from the correct env/config key and was not truncated
Example fix
// before RemoteSource(source="http://example.com/config.toml") // after RemoteSource(source="https://example.com/config.toml")
Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlparse
def is_valid_remote_source(source: str) -> bool:
parsed = urlparse(source)
return parsed.scheme.lower() == "https" and bool(parsed.hostname)
# call before constructing
if not is_valid_remote_source(src):
src = f"https://{src}" # or surface a config error Type guard
def is_https_url(value: object) -> bool:
if not isinstance(value, str) or not value.isascii():
return False
parsed = urlparse(value)
return parsed.scheme.lower() == "https" and bool(parsed.hostname) Try / catch
try:
RemoteSource(source=src)
except ValueError as exc:
logger.error("invalid remote source %r: %s", src, exc)
raise ConfigError(f"remote source {src!r} must be an absolute HTTPS URL") from exc Prevention
- Always include the https:// scheme in config values; never accept bare hosts
- Lint config files for scheme before deployment
- Validate env-sourced URLs at startup, not deep in the run
When it happens
Trigger: Constructing a dataclass (e.g. a remote provider/remote_source descriptor) whose __post_init__ calls _validate_remote_source_url with a source that is not 'https' scheme or has no hostname: e.g. 'http://example.com/src.toml', 'example.com/src.toml', 'ftp://example.com/x', or a URL whose scheme was mangled ('https:example.com' with empty hostname).
Common situations: Typing 'http://' instead of 'https://' in a config file; pasting a URL without scheme ('example.com/config.toml'); hand-building the remote source from an env var that lost its scheme; using a file path or git URL where an HTTPS URL is expected.
Related errors
- remote_source must be a validated absolute HTTPS URL
- Remote marketplace sources must use https
- {what} must be absolute: {path}
- Home directory is not absolute: {launch_home}. Set $HOME to
- Invalid {SERVER_ENV_PREFIX}ALLOW_FS_TOOLS value: unknown fil
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/dadd3f8e3cc95e89.
Report an issue: GitHub.