fix: When the AGFS backend is s3, the error "pyagfs.exceptions.AGFSClientError: parent directory does not exist" occurs.#254
Merged
MaojiaSheng merged 1 commit intovolcengine:mainfrom Feb 22, 2026
Conversation
…ientError: parent directory does not exist" occurs.
MaojiaSheng
approved these changes
Feb 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: When the AGFS backend is s3, the error "pyagfs.exceptions.AGFSClientError: parent directory does not exist" occurs.
Description
In the commit Refactor S3 configuration , VikingFS.mkdir did not perform AGFS's mkdir operation on the target directory (see lines 141–153 of the current repository viking_fs.py, where only the parent directories are guaranteed by _ensure_parent_dirs), so it did not trigger s3fs's "parent directory must exist" check. However, in the latest version of the code you are currently using, VikingFS.mkdir is changed to directly call self.agfs.mkdir(path), causing s3fs to return "parent directory does not exist" when the parent directory does not exist.
Related Issue
Type of Change
Changes Made
First, check for explicit directory tag files (using HeadObject).
If a directory tag file exists, return True directly.
If it doesn't exist, use ListObjectsV2 to check if an object starting with that prefix exists.
Testing
Checklist
Screenshots (if applicable)
Additional Notes
error stack:
2026-02-22 22:25:21,070 - openviking.parse.parsers.markdown - ERROR - [MarkdownParser] Parse failed: parent directory does not exist: temp/02222225_5d4083
Traceback (most recent call last):
File "./.venv/lib/python3.11/site-packages/pyagfs/client.py", line 260, in mkdir
response.raise_for_status()
File "./.venv/lib/python3.11/site-packages/requests/models.py", line 1026, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://localhost:8080/api/v1/directories?path=%2Flocal%2Ftemp%2F02222225_5d4083%2Ftmp2uppf5pw&mode=755
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./openviking/parse/parsers/markdown.py", line 190, in parse_content
await self._parse_and_create_structure(content, headings, root_dir, source_path)
File "./openviking/parse/parsers/markdown.py", line 386, in _parse_and_create_structure
await viking_fs.mkdir(root_dir)
File "./openviking/storage/viking_fs.py", line 158, in mkdir
self.agfs.mkdir(path)
File "./.venv/lib/python3.11/site-packages/pyagfs/client.py", line 263, in mkdir
self._handle_request_error(e)
File "./.venv/lib/python3.11/site-packages/pyagfs/client.py", line 54, in _handle_request_error
raise AGFSClientError(error_msg)
pyagfs.exceptions.AGFSClientError: parent directory does not exist: temp/02222225_5d4083
Error: 'root_uri'
fix
(.venv) OpenViking % openviking add-resource https://github.com/volcengine/OpenViking/blob/main/README_CN.md
status errors source_path meta root_uri
success [] /var/folders/52/2t1rc00n17x83f71n73_3zzh0000gn/T/tmplhvb_7wa.md {'url': 'https://github.com/volcengine/OpenViking/blob/main/README_CN.md', 'detected_by': 'extension', 'extension': '.md', 'downloaded_from': 'https://github.com/volcengine/OpenViking/blob/main/README_CN.md', 'url_type': 'download_markdown'} viking://resources/tmplhvb_7wa
(.venv) OpenViking % openviking