gitea_file_delete returns "repository file already exists" error #14

Closed
opened 2026-06-07 18:53:06 +00:00 by jmiller · 1 comment
Owner

Bug

The gitea_file_delete tool returns an incorrect error message when attempting to delete a file:

Error: repository file already exists [path: .mokogitea/workflows/update-server.yml]

This error makes no sense for a DELETE operation — it appears the tool may be hitting the wrong API endpoint or using the wrong HTTP method internally.

Steps to Reproduce

  1. Get a file's SHA via gitea_file_get
  2. Call gitea_file_delete with correct owner, repo, filepath, sha, and message
  3. Receive error: repository file already exists

Example Call

{
  "owner": "MokoConsulting",
  "repo": "mokogitea-org-config",
  "filepath": ".mokogitea/workflows/update-server.yml",
  "sha": "339d3f5c6f967fa7af96ffdd676169ec7b0fb804",
  "message": "chore: remove deprecated update-server.yml workflow"
}

Also tried with explicit "branch": "main" — same error.

Expected Behavior

File should be deleted and a commit created with the provided message.

Workaround Attempted

Using gitea_api_request with DELETE method on the /contents/ endpoint — this returned jsontext: unexpected EOF (likely a 200 response with empty body that the MCP server can't parse). The file was NOT actually deleted.

## Bug The `gitea_file_delete` tool returns an incorrect error message when attempting to delete a file: ``` Error: repository file already exists [path: .mokogitea/workflows/update-server.yml] ``` This error makes no sense for a DELETE operation — it appears the tool may be hitting the wrong API endpoint or using the wrong HTTP method internally. ## Steps to Reproduce 1. Get a file's SHA via `gitea_file_get` 2. Call `gitea_file_delete` with correct owner, repo, filepath, sha, and message 3. Receive error: `repository file already exists` ## Example Call ```json { "owner": "MokoConsulting", "repo": "mokogitea-org-config", "filepath": ".mokogitea/workflows/update-server.yml", "sha": "339d3f5c6f967fa7af96ffdd676169ec7b0fb804", "message": "chore: remove deprecated update-server.yml workflow" } ``` Also tried with explicit `"branch": "main"` — same error. ## Expected Behavior File should be deleted and a commit created with the provided message. ## Workaround Attempted Using `gitea_api_request` with `DELETE` method on the `/contents/` endpoint — this returned `jsontext: unexpected EOF` (likely a 200 response with empty body that the MCP server can't parse). The file was NOT actually deleted.
Author
Owner

Branch created: feature/14-

git fetch origin
git checkout feature/14-
Branch created: [`feature/14-`](https://git.mokoconsulting.tech/MokoConsulting/mcp-mokogitea-api/src/branch/feature/14-) ```bash git fetch origin git checkout feature/14- ```
Sign in to join this conversation.