← Back to AI Insights
Gemini Executive Synthesis

OpenWiki's `read-tool` MIME type detection logic, specifically its failure to correctly classify common text files (e.g., `Makefile`, `Dockerfile`) and its incorrect handling of binary files when interacting with the Anthropic provider.

Technical Positioning
Accurate and robust file content processing for AI agents, ensuring compatibility with diverse file types and LLM API requirements.
SaaS Insight & Market Implications
This issue exposes a critical flaw in OpenWiki's `read-tool` MIME type detection, leading to `INVALID_TOOL_RESULTS` errors with the Anthropic API. The reliance on extension-based mapping incorrectly classifies common text files (e.g., `Makefile`, `Dockerfile`) as `application/octet-stream`, causing them to be sent as base64 documents. This violates Anthropic's API schema, which expects `application/pdf` for documents, resulting in agent crashes. The problem is compounded by similar mishandling of actual binary files. This fundamental misclassification severely limits OpenWiki's ability to process typical codebases, directly impacting its reliability and utility for documentation generation. A robust, content-aware MIME detection strategy is imperative.
Proprietary Technical Taxonomy
Anthropic provider 400 INVALID_TOOL_RESULTS invalid_request_error messages.content.document.source.base64.media_type read-tool MIME detection extension-map based application/octet-stream base64 document block

Raw Developer Origin & Technical Request

Source Icon GitHub Issue Jul 2, 2026
Repo: langchain-ai/openwiki
Anthropic 400 INVALID_TOOL_RESULTS: files with unmapped/no extension (Makefile, Dockerfile, uv.lock) are sent as base64 documents

## Summary

`openwiki --init` / `--update` reliably crashes mid-run with Anthropic provider on any real-world repo:

```
400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.56.content.2.tool_result.content.0.document.source.base64.media_type: Input should be 'application/pdf'"}}

Troubleshooting URL: docs.langchain.com/oss/javascript/la...
```

## Root cause

The read-tool MIME detection in the bundled `deepagents` dist (`langsmith-*.js` / `langsmith-*.cjs`) is extension-map based:

```js
function getMimeType(filePath) {
return MIME_TYPES[extname(filePath).toLocaleLowerCase()] || "application/octet-stream";
}
function isTextMimeType(mimeType) {
return mimeType.startsWith("text/") || mimeType === "application/json" || mimeType === "application/javascript" || mimeType === "image/svg+xml";
}
```

Two problems:

1. **Any file whose extension is not in `MIME_TYPES` falls back to `application/octet-stream`** and is treated as binary → base64 `document` block. This includes perfectly ordinary text files every repo has: `Makefile`, `Dockerfile`, `Caddyfile`, `LICENSE` (Node `extname()` returns `""` for extensionless files — the `.makefile`/`.dockerfile` map entries never match them), plus `uv.lock`, `*.mermaid`, `*.mako`, `.env.example`, etc. So the agent crashes as soon as it reads a Makefile.
2. **Actual binary files (.png, .xlsx, .docx) are also sent as `document` blocks**, but the Anthropic Messages API ...

Developer Debate & Comments

No active discussions extracted for this entry yet.

Adjacent Repository Pain Points

Other highly discussed features and pain points extracted from langchain-ai/openwiki.

Extracted Positioning
Integration of GitHub Copilot CLI as a first-class model provider within OpenWiki.
Enterprise-ready, frictionless AI agent deployment leveraging existing organizational infrastructure and licensing.
Extracted Positioning
OpenWiki's `read_file` tool handling of non-text files, specifically when interacting with the Fireworks provider, leading to 400 validation errors due to incorrect message content formatting.
Seamless and robust file processing capabilities for AI agents, supporting diverse file types without API validation failures.
Extracted Positioning
OpenWiki's reliance on OpenRouter for model provision, specifically the inability to control or "pin" specific sub-providers within OpenRouter, leading to unreliable model responses and tool invocation failures.
Robust and reliable AI agent operation, with predictable model behavior and successful tool execution.
Extracted Positioning
OpenWiki global installation on Windows, specifically its dependency `better-sqlite3` failing to build with Bun due to `node-gyp` and Visual Studio toolchain issues.
Seamless global installation experience for OpenWiki across different OS/runtime environments (Bun on Windows).

Frequently Asked Questions

Market intelligence mapped to OpenWiki's `read-tool` MIME type detection logic, specifically its failure to correctly classify common text files (e.g., `Makefile`, `Dockerfile`) and its incorrect handling of binary files when interacting with the Anthropic provider..

What is the technical positioning of OpenWiki's `read-tool` MIME type detection logic, specifically its failure to correctly classify common text files (e.g., `Makefile`, `Dockerfile`) and its incorrect handling of binary files when interacting with the Anthropic provider.?
Based on our AI analysis of the original developer request, its primary technical positioning is: Accurate and robust file content processing for AI agents, ensuring compatibility with diverse file types and LLM API requirements.
What are the foundational technologies related to OpenWiki's `read-tool` MIME type detection logic, specifically its failure to correctly classify common text files (e.g., `Makefile`, `Dockerfile`) and its incorrect handling of binary files when interacting with the Anthropic provider.?
Our proprietary extraction maps OpenWiki's `read-tool` MIME type detection logic, specifically its failure to correctly classify common text files (e.g., `Makefile`, `Dockerfile`) and its incorrect handling of binary files when interacting with the Anthropic provider. to adjacent architectural concepts including Anthropic provider, 400 INVALID_TOOL_RESULTS, invalid_request_error, messages.content.document.source.base64.media_type.

Engagement Signals

0
Replies
open
Issue Status

Cross-Market Term Frequency

Quantifies the cross-market adoption of foundational terms like invalid_request_error and text/ by tracking occurrence frequency across active SaaS architectures and enterprise developer debates.