{"record":{"id":"9d36f3b80898ad8e","repo":"rohitg00/ai-engineering-from-scratch","slug":"publisher-domain-must-be-a-valid-multi-label-dns-n","errorCode":null,"errorMessage":"publisher domain must be a valid multi-label DNS name","messagePattern":"publisher domain must be a valid multi-label DNS name","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/13-mcp-server-with-registry/code/main.py","lineNumber":381,"sourceCode":"        issues.append(\"remote profile requires a non-empty remotes list\")\n    else:\n        for index, remote in enumerate(remotes):\n            if not isinstance(remote, dict):\n                issues.append(f\"remotes[{index}] must be an object\")\n                continue\n            if remote.get(\"type\") not in {\"streamable-http\", \"sse\"}:\n                issues.append(f\"remotes[{index}].type must be streamable-http or sse\")\n            remote_url = remote.get(\"url\")\n            if not isinstance(remote_url, str) or REMOTE_URL_RE.fullmatch(remote_url) is None:\n                issues.append(f\"remotes[{index}].url must be an http(s) URL template\")\n    return issues\n\n\ndef reverse_dns_namespace(domain: str) -> str:\n    normalized = domain.casefold().rstrip(\".\")\n    labels = normalized.split(\".\")\n    if len(labels) < 2 or any(DOMAIN_LABEL_RE.fullmatch(label) is None for label in labels):\n        raise ValueError(\"publisher domain must be a valid multi-label DNS name\")\n    return \".\".join(reversed(labels))\n\n\ndef validate_publisher_namespace(document: object, verified_domain: str) -> list[str]:\n    \"\"\"Check domain ownership outside the server.json shape contract.\"\"\"\n    if not isinstance(document, dict) or not isinstance(document.get(\"name\"), str):\n        return []\n    namespace = document[\"name\"].partition(\"/\")[0]\n    expected = reverse_dns_namespace(verified_domain)\n    if namespace != expected and not namespace.startswith(f\"{expected}.\"):\n        return [\n            f\"name namespace must be {expected} or its child for verified domain {verified_domain}\"\n        ]\n    return []\n\n\ndef validate_runtime_alignment(document: dict, discovery: object) -> list[str]:\n    \"\"\"Compare publication identity with the live server/discover identity.\"\"\"","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/13-mcp-server-with-registry/code/main.py#L363-L399","documentation":"Error \"publisher domain must be a valid multi-label DNS name\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/13-mcp-server-with-registry/code/main.py:381 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}