rohitg00/ai-engineering-from-scratch · error · ContractViolation
recognized parameter header is duplicated
Error message
recognized parameter header is duplicated
What it means
Error "recognized parameter header is duplicated" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/13-tools-and-protocols/28-mcp-tool-contracts-and-content/code/main.py:625
for supplied_name, supplied_value in headers.items():
normalized.setdefault(supplied_name.casefold(), []).append(
(supplied_name, supplied_value)
)
checked_names: list[str] = []
properties = tool["inputSchema"].get("properties", {})
for path, suffix in validate_header_annotations(tool):
expected_name = f"Mcp-Param-{suffix}"
supplied = normalized.get(expected_name.casefold(), [])
body_value = _read_path(arguments, path)
if body_value is MISSING:
if supplied:
raise ContractViolation("recognized parameter header has no body argument")
continue
if not supplied:
raise ContractViolation("recognized parameter header is missing")
if len(supplied) != 1:
raise ContractViolation("recognized parameter header is duplicated")
decoded = decode_parameter_header_value(supplied[0][1])
expected = _parameter_text(body_value, properties[path[0]]["type"])
if decoded != expected:
raise ContractViolation("recognized parameter header does not match the body")
checked_names.append(expected_name)
audit_log.append(
{
"event": "parameter_headers_validated",
"headerNames": sorted(checked_names),
}
)
def streamable_http_tool_call(
server: ContractServer,
request: dict[str, Any],
headers: dict[str, str],View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/13-tools-and-protocols/28-mcp-tool-contracts-and-content/code/main.py:625 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/65f8d0f7d8241306.
Report an issue: GitHub.