Commits API returns "ファイル is missing" error when updating existing file
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
The create_commit API endpoint consistently returns HTTP 400 error with message {'error': 'ファイル is missing'} when attempting to update an existing file in a repository via GitLab Duo Chat, even though the file exists and can be successfully retrieved via get_repository_file.
Steps to reproduce
- Use GitLab Duo Chat to request a file update
- GitLab Duo verifies file exists using GET
/api/v4/projects/{id}/repository/files/{file_path}?ref=test- File:
Janken.java - Branch:
test - Result: File content successfully retrieved
- File:
- GitLab Duo attempts to update the same file using POST
/api/v4/projects/{id}/repository/commits- Action:
update - File path:
Janken.java - Branch:
test(existing branch) - Result: HTTP 400
{'error': 'ファイル is missing'}
- Action:
Actual behavior
The API returns:
HTTP 400: {'error': 'ファイル is missing'}
This error occurs consistently across multiple attempts with different approaches:
- Direct update to existing branch
- Creating new branch with
start_branchparameter - Using both full
contentand partialold_str/new_strupdate methods
Expected behavior
The commit should be created successfully, updating the file content on the specified branch, allowing GitLab Duo Chat to complete the requested file modification.
Environment
- GitLab version: 18.6.2
- Instance type: Self-Managed
-
API endpoint:
/api/v4/projects/14/repository/commits - GitLab Duo Model: Claude Sonnet 4.5 - Vertex
-
Tool used:
create_commitfunction via GitLab Duo Chat
Additional context
- The error message is in Japanese: "ファイル is missing" (File is missing)
- The file
Janken.javaexists at the repository root and is accessible via the repository files API - The same error occurs regardless of whether the file path includes or excludes leading slashes
- Other API endpoints (get_repository_file, list_repository_tree) work correctly for the same file
- GitLab Duo Chat can successfully read the file but cannot update it
- This blocks GitLab Duo's ability to perform code modifications requested by users
Impact on GitLab Duo
This issue prevents GitLab Duo Chat from completing its core functionality of modifying code files based on user requests. Users must resort to manual file editing, defeating the purpose of the AI-assisted development workflow.
Possible causes
- File path encoding issue with non-ASCII characters in the repository
- Branch reference validation problem specific to API calls from GitLab Duo
- API parameter validation bug in the commits endpoint
- Inconsistency between file retrieval and commit creation APIs
- Permission or authentication issue specific to GitLab Duo's API access
Request payload example
{
"branch": "test",
"commit_message": "勝率50%超えでおめでとうメッセージを追加",
"actions": [
{
"action": "update",
"file_path": "Janken.java",
"content": "<full file content>"
}
]
}