rohitg00/ai-engineering-from-scratch · error · ValueError

a verified namespace domain needs at least two labels

Error message

a verified namespace domain needs at least two labels

What it means

Error "a verified namespace domain needs at least two labels" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/13-tools-and-protocols/30-mcp-registry-supply-chain-and-drift/code/main.py:35

PROTOCOL_VERSION = "2026-07-28"
PUBLISHER_META_KEY = "io.modelcontextprotocol.registry/publisher-provided"
OFFICIAL_META_KEY = "io.modelcontextprotocol.registry/official"
SERVER_INFO_KEY = "io.modelcontextprotocol/serverInfo"


def canonical_json(value: Any) -> str:
    return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True)


def digest(value: Any) -> str:
    return hashlib.sha256(canonical_json(value).encode("utf-8")).hexdigest()


def namespace_for_domain(domain: str) -> str:
    labels = [label.lower() for label in domain.strip().strip(".").split(".") if label]
    if len(labels) < 2:
        raise ValueError("a verified namespace domain needs at least two labels")
    return ".".join(reversed(labels))


def namespace_matches(server_name: str, verified_namespace: str) -> bool:
    prefix, separator, slug = server_name.partition("/")
    return separator == "/" and bool(slug) and prefix == verified_namespace


def normalized_tools(tools: list[dict[str, Any]]) -> list[dict[str, Any]]:
    return sorted(tools, key=lambda item: (str(item.get("name", "")), canonical_json(item)))


def registry_status(api_meta: dict[str, Any]) -> str:
    official = api_meta.get(OFFICIAL_META_KEY) if isinstance(api_meta, dict) else None
    return str(official.get("status", "")) if isinstance(official, dict) else ""


def is_sha256_digest(value: Any) -> bool:

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/13-tools-and-protocols/30-mcp-registry-supply-chain-and-drift/code/main.py:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26). Data as JSON: /api/errors/4f8afe2e625120f8. Report an issue: GitHub.