{"record":{"id":"402f75ecfdbb9493","repo":"rohitg00/ai-engineering-from-scratch","slug":"legacy-fallback-is-not-allowlisted-for-this-endpoi","errorCode":null,"errorMessage":"legacy fallback is not allowlisted for this endpoint","messagePattern":"legacy fallback is not allowlisted for this endpoint","errorType":"validation","errorClass":"ProtocolViolation","httpStatus":null,"severity":"error","filePath":"phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py","lineNumber":344,"sourceCode":"def select_era(\n    observation: dict[str, Any],\n    policy: str,\n    legacy_allowed: bool = False,\n    legacy_evidence: dict[str, Any] | None = None,\n) -> str:\n    if policy not in {\"strict\", \"fallback\"}:\n        raise ValueError(\"policy must be strict or fallback\")\n    kind = observation.get(\"kind\")\n    if kind == \"discover_success\":\n        return \"modern\"\n    if kind == \"jsonrpc_error\" and observation.get(\"code\") in MODERN_ERROR_CODES:\n        return \"modern\"\n    if policy == \"strict\":\n        raise ProtocolViolation(\"modern support was not proven; strict policy forbids fallback\")\n    if kind not in {\"empty\", \"timeout\", \"connection_closed\", \"unrecognized\"}:\n        raise ProtocolViolation(\"probe outcome is not safe evidence for fallback\")\n    if not legacy_allowed:\n        raise ProtocolViolation(\"legacy fallback is not allowlisted for this endpoint\")\n    if not isinstance(legacy_evidence, dict):\n        raise ProtocolViolation(\"inconclusive modern probe is not positive legacy evidence\")\n    if (\n        legacy_evidence.get(\"kind\") != \"initialize_success\"\n        or legacy_evidence.get(\"protocolVersion\") != LEGACY_VERSION\n    ):\n        raise ProtocolViolation(\"legacy probe did not prove the configured legacy era\")\n    return \"legacy\"\n\n\ndef notification_http_outcome(request: dict[str, Any]) -> tuple[int, None]:\n    if \"id\" in request:\n        raise ValueError(\"request has an id and is not a notification\")\n    return 202, None\n\n\n@dataclass(frozen=True)\nclass Transcript:","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py#L326-L362","documentation":"Error \"legacy fallback is not allowlisted for this endpoint\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:344 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"}