affaan-m/ECC · error · ValueError

remote import exceeds {max_bytes} bytes

Error message

remote import exceeds {max_bytes} bytes

What it means

Error "remote import exceeds {max_bytes} bytes" thrown in affaan-m/ECC.

Source

Thrown at skills/continuous-learning-v2/scripts/instinct-cli.py:234

            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)
# ─────────────────────────────────────────────

def _git_repo_root(cwd: Optional[str] = None) -> Optional[str]:

View on GitHub (pinned to 01e15490f0)

Solutions

  1. The remote instinct file exceeds the 2 MiB cap. Split it into smaller instinct files and import them separately.
  2. Host a trimmed version containing only the needed instincts; the cap exists to bound memory and parsing time.

Example fix

split -b 1m big-instinct.md part- && for f in part-*; do instinct import "$f"; done

When it happens

Trigger: Thrown at skills/continuous-learning-v2/scripts/instinct-cli.py:234 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/6a1eca588e450606. Report an issue: GitHub.