Title: create_or_update_file rejects explicitly empty file content · Issue #3883 · github/github-mcp-server · GitHub
Open Graph Title: create_or_update_file rejects explicitly empty file content · Issue #3883 · github/github-mcp-server
X Title: create_or_update_file rejects explicitly empty file content · Issue #3883 · github/github-mcp-server
Description: Description create_or_update_file rejects an explicitly supplied empty string with missing required parameter: content, preventing agents from creating empty package markers such as __init__.py / .gitkeep, or intentionally clearing an ex...
Open Graph Description: Description create_or_update_file rejects an explicitly supplied empty string with missing required parameter: content, preventing agents from creating empty package markers such as __init__.py / ....
X Description: Description create_or_update_file rejects an explicitly supplied empty string with missing required parameter: content, preventing agents from creating empty package markers such as __init__.py / ....
Opengraph URL: https://github.com/github/github-mcp-server/issues/3883
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"create_or_update_file rejects explicitly empty file content","articleBody":"### Description\n\n`create_or_update_file` rejects an explicitly supplied empty string with `missing required parameter: content`, preventing agents from creating empty package markers such as `__init__.py` / `.gitkeep`, or intentionally clearing an existing file.\n\nThe tool schema requires a string but does not impose a minimum length. The GitHub Contents API accepts empty base64 content, and `push_files` already distinguishes absent content from an explicitly empty string.\n\n### Reproduction\n\nCall the tool with `{\"owner\":\"owner\",\"repo\":\"repo\",\"path\":\"__init__.py\",\"branch\":\"main\",\"message\":\"Add package marker\",\"content\":\"\"}`. Expected: a Contents API request with `content: \"\"`. Actual: the tool returns an error before making any HTTP request. Updating an existing ordinary file with its current SHA fails in the same way.\n\nReproduced at `4e6e6c053e48aac182f7768162fef2ad42fe7d5f` through `CreateOrUpdateFile(...).Handler(...)`, using the real go-github REST client with a controlled HTTP transport. Two new regression cases fail; existing nonempty create/update cases pass. No live repository write was performed in reproduction.\n\nI plan to allow explicitly empty content while continuing to reject absent/null content, preserving the existing exported Go input type, JSON schema, SHA validation and symlink protections. I checked the complete open PR file lists and relevant closed PRs; #3313 (binary encoding) and #2772 (GraphQL migration) retain the empty-string rejection and address different behavior.\n\nThis report and proposed fix were prepared with AI assistance.\n","author":{"url":"https://github.com/Elon-Jiang","@type":"Person","name":"Elon-Jiang"},"datePublished":"2026-11-18T09:29:10Z","url":"https://github.com/github/github-mcp-server/issues/3883"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:de6c2ffe-4ad1-5075-9fb5-9385ff327f75 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A22E:394F2A:48588B:6072A6:6B061ECD |
| html-safe-nonce | f5bd5f342a10d51e47daaa855bc52d31d6dd849388e09f17ffce5ede0ea7a80b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjJFOjM5NEYyQTo0ODU4OEI6NjA3MkE2OjZCMDYxRUNEIiwidmlzaXRvcl9pZCI6IjI0MzMzOTUyNTQ3MDg1NDMxODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ecd7faf87a70eb961f091edfe46c0c902f6306aaf40d748f6a9a71eaa88336b2 |
| hovercard-subject-tag | issue:6464053141 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3883/issue_layout |
| twitter:image | https://opengraph.githubassets.com/02f946f28b691196d65897928aa224523ce4842f4065375062ba897bf5c6bd86/github/github-mcp-server/issues/3883 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/02f946f28b691196d65897928aa224523ce4842f4065375062ba897bf5c6bd86/github/github-mcp-server/issues/3883 |
| og:image:alt | Description create_or_update_file rejects an explicitly supplied empty string with missing required parameter: content, preventing agents from creating empty package markers such as __init__.py / .... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Elon-Jiang |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9a7c5824b75ea2ec5e3de73a483229c7bb9f32a774ffd401f010dd9bacf1483d |
| turbo-cache-control | no-preview |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b25c3080e84402f75431d8dc7a96b2635219cec7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width