affaan-m/ECC · error · ValueError
unsupported remote content type
Error message
unsupported remote content type: {content_type} What it means
Raised by _fetch_import_url when the fetched response's Content-Type header is present but does not contain any allowed token (text/, markdown, yaml, json, octet-stream). The CLI only accepts content types it can safely treat as a text/markdown instinct file. This prevents pulling binary or executable content from remote URLs.
Solutions
- Point the import URL at the raw file (e.g. raw.githubusercontent.com instead of an HTML blob page) so the server returns text/plain or text/markdown.
- Fix server MIME configuration to serve .yaml/.md as text/yaml or text/markdown.
- Verify the URL is correct — a 404/redirect page often comes with an unexpected content type.
- Check the header before calling: urllib request and inspect Content-Type against the allowed list.
Example fix
# before url = "https://example.com/files/instincts" # served as application/pdf # after url = "https://raw.githubusercontent.com/org/repo/main/instincts.yaml" # text/plain
Defensive patterns
Strategy: validation
Validate before calling
import urllib.request
req = urllib.request.Request(source, method="HEAD")
with urllib.request.urlopen(req, timeout=15) as r:
ct = r.headers.get("Content-Type", "")
allowed = ("text/", "markdown", "yaml", "json", "octet-stream")
if ct and not any(a in ct.lower() for a in allowed):
raise ValueError(f"unsupported content type: {ct}") Try / catch
try:
cli_import(url=source)
except ValueError as e:
if "content type" in str(e):
print("URL must serve text/markdown/yaml/json content") Prevention
- Link raw file URLs, not HTML blob or binary pages
- Ensure servers serve .yaml/.md with text/* MIME types
- HEAD-check Content-Type before importing
- Verify the link isn't redirecting to an error/asset page
When it happens
Trigger: Server responds with Content-Type like application/x-executable, application/zip, text/html is fine (text/) but e.g. image/png, application/octet-stream variants are allowed — fails on application/pdf, video/mp4, application/x-msdownload, or empty-allowlist mismatches like 'application/x-yaml; charset=UTF-16'.
Common situations: The URL redirects to an HTML login page served as text/html (allowed) vs. a CDN serving image/png for a mistyped link; a server misconfigured to emit application/binary; a link pointing at an archive rather than the raw file.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- remote import exceeds
- remote import host resolves to a non-public address
- remote instinct imports require https URLs
- download failed; existing destination preserved
- download length does not match declared size
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/1aad851908b9476c.
Report an issue: GitHub.
Appendix: source
Thrown at skills/continuous-learning-v2/scripts/instinct-cli.py:231
or ip.is_reserved
or ip.is_unspecified
):
raise ValueError(f"remote import host resolves to a non-public address: {host}")
return urllib.parse.urlunparse(parsed)
def _fetch_import_url(source: str, *, max_bytes: int = 2 * 1024 * 1024) -> str:
"""Fetch a validated remote instinct file with bounded size and timeout."""
url = _validate_import_url(source)
req = urllib.request.Request(url, headers={"User-Agent": "ECC-instinct-import/2"})
with urllib.request.urlopen(req, timeout=15) as response:
content_type = response.headers.get("Content-Type", "")
if content_type and not any(
allowed in content_type.lower()
for allowed in ("text/", "markdown", "yaml", "json", "octet-stream")
):
raise ValueError(f"unsupported remote content type: {content_type}")
data = response.read(max_bytes + 1)
if len(data) > max_bytes:
raise ValueError(f"remote import exceeds {max_bytes} bytes")
return data.decode("utf-8")
def _yaml_quote(value: str) -> str:
"""Quote a string for safe YAML frontmatter serialization.
Uses double quotes and escapes embedded double-quote characters to
prevent malformed YAML when the value contains quotes.
"""
escaped = value.replace('\\', '\\\\').replace('"', '\\"')
return f'"{escaped}"'
# ─────────────────────────────────────────────
# Project Detection (Python equivalent of detect-project.sh)View on GitHub (pinned to 8321021c54)