{"record":{"id":"1aaf11cf4e55af19","repo":"headroomlabs-ai/headroom","slug":"invalid-tool-call-or-not-a-ccr-tool-name-call","errorCode":null,"errorMessage":"Invalid tool call or not a {CCR_TOOL_NAME} call","messagePattern":"Invalid tool call or not a (.+?) call","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"headroom/proxy/server.py","lineNumber":4999,"sourceCode":"                \"provider\": \"openai\"\n            }\n\n        Response:\n            {\n                \"tool_result\": {...},  # Formatted for the provider\n                \"success\": true,\n                \"data\": {...}  # Raw retrieval data\n            }\n        \"\"\"\n        data = await request.json()\n        tool_call = data.get(\"tool_call\", {})\n        provider = data.get(\"provider\", \"anthropic\")\n\n        # Parse the tool call\n        hash_key = parse_tool_call(tool_call, provider)\n\n        if hash_key is None:\n            raise HTTPException(\n                status_code=400, detail=f\"Invalid tool call or not a {CCR_TOOL_NAME} call\"\n            )\n\n        # Perform retrieval\n        store = get_compression_store()\n        entry_status = store.get_entry_status(hash_key, clean_expired=True)\n\n        if entry_status[\"status\"] != \"available\":\n            retrieval_data = {\n                \"error\": format_retrieval_miss_detail(entry_status),\n                \"hash\": hash_key,\n                \"status\": entry_status[\"status\"],\n                \"ttl_seconds\": entry_status.get(\"ttl_seconds\", entry_status[\"default_ttl_seconds\"]),\n            }\n        else:\n            # Retrieval is by hash: always return the full original content.\n            entry = store.retrieve(hash_key)\n            if entry:","sourceCodeStart":4981,"sourceCodeEnd":5017,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/proxy/server.py#L4981-L5017","documentation":"POST /v1/retrieve/tool_call parses the submitted tool_call for the given provider (default anthropic) and returns HTTP 400 when parsing yields no hash — the payload is malformed or is not a headroom_retrieve (CCR_TOOL_NAME) call. This is request-shape validation, not a store miss.","triggerScenarios":"Posting a tool_call for a different tool name, missing the hash argument, wrong provider string so the parse format mismatches, or an arbitrary JSON object.","commonSituations":"Agent frameworks forwarding every LLM tool call indiscriminately; provider field not matching the actual tool_call format; schema drift in tool-call JSON.","solutions":["Send only headroom_retrieve tool calls to this endpoint.","Match the provider field to the actual payload ('anthropic', 'openai', ...).","Ensure the tool-call arguments include the compression hash.","For raw hashes, use POST /v1/retrieve with {\"hash\": ...} instead."],"exampleFix":"# before\n{\"tool_call\": {\"name\": \"web_search\", \"arguments\": {}}, \"provider\": \"anthropic\"}\n\n# after\n{\"tool_call\": {\"name\": \"headroom_retrieve\", \"arguments\": {\"hash\": \"abc123\"}}, \"provider\": \"anthropic\"}","handlingStrategy":"validation","validationCode":"def is_retrieve_call(tool_call: dict) -> bool:\n    return tool_call.get(\"name\") == \"headroom_retrieve\" and bool(\n        (tool_call.get(\"arguments\") or {}).get(\"hash\")\n    )","typeGuard":"def is_retrieve_call(tc: dict) -> bool:\n    name = tc.get(\"name\") or tc.get(\"function\", {}).get(\"name\")\n    return name == \"headroom_retrieve\"","tryCatchPattern":"resp = await client.post(\"/v1/retrieve/tool_call\", json=payload)\nif resp.status_code == 400:\n    route_elsewhere(payload)  # not a headroom_retrieve call; don't retry","preventionTips":["Filter tool calls by name before hitting the endpoint.","Keep the provider field consistent with the payload format."],"tags":["http","validation","tool-call"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}