You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File Upload: Full path is being passed as the document name to the AP #36113
Uploaded a PDF named SOP.pdf to OpenCode and got the following error:
undefined: The document file name can only contain alphanumeric characters, whitespace characters, hyphens, parentheses, and square brackets. The name can't contain more than one consecutive whitespace character. Check that the file name conforms to these restrictions and retry your request.
It appears that the full file path "/User/laflamablanc/Downloads/SOP.pdf" is being passed as the filename and throwing an error
The Bedrock/Anthropic API is sending back the error that this is an invalid name.
Request: Clean up the filepath and only send the filename to the API
This issue might be a duplicate of an existing issue. Please check:
Bedrock: file extension included in DocumentBlock name causes validation error #19964: Bedrock DocumentBlock name validation error — same error message about invalid characters in the document file name, previously reported when the file extension was included. This new report indicates the full file path is being passed instead of just the filename, which is a related (possibly the same underlying) bug.
The issue is in packages/opencode/src/session/prompt.ts — when a file is attached, the filename field is set to whatever path string was used
This gets passed through message-v2.ts into the AI SDK's convertToModelMessages(), which then sends it to the Anthropic/Bedrock API as the document name. The API rejects filenames containing / characters.
The fix would be a one-liner in prompt.ts to use path.basename(filename) instead of the full path when setting the filename field on file parts.
Version 1.18.1 (latest)
Date 2026-07-15T12:38:27.653Z
OS Linux 6.8.0-134-generic (arm64)
Terminal xterm-256color
Session IDses_09a3a6cf0ffegoP0YYJYWqmQti
Model amazon-bedrock/us.anthropic.claude-opus-4-8
Activity
github-actions commentedon Jul 9, 2026
This issue might be a duplicate of an existing issue. Please check:
laflamablanc commentedon Jul 9, 2026
The issue is in packages/opencode/src/session/prompt.ts — when a file is attached, the filename field is set to whatever path string was used
This gets passed through message-v2.ts into the AI SDK's convertToModelMessages(), which then sends it to the Anthropic/Bedrock API as the document name. The API rejects filenames containing / characters.
The fix would be a one-liner in prompt.ts to use path.basename(filename) instead of the full path when setting the filename field on file parts.
joaomj commentedon Jul 15, 2026
i am facing the same issue with bedrock.
github-actions commentedon Sep 14, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.