Skip to content

Commit 68849dd

Browse files
committed
fix(providers): fail clearly when a large attachment has no cloud storage
The doc claimed a base64 fallback that doesn't exist — above the inline cap there is no base64, so without cloud storage the file previously reached the builder and died with a generic read error. Throw a clear 'requires cloud file storage' error at the point of detection and correct the doc.
1 parent 1919059 commit 68849dd

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

apps/sim/providers/file-attachments.server.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ function* iterateRequestFiles(messages: Message[] | undefined): Generator<UserFi
3737
* Resolves every attachment that exceeds the inline threshold on a large-file-capable
3838
* provider to a short-lived signed URL on `file.remoteUrl`. `remote-url` providers send it
3939
* to the model directly; for `files-api` providers it marks the file for upload (the bytes
40-
* are read from storage at upload time). Requires cloud storage — otherwise large files
41-
* fall back to the (capped) base64 path.
40+
* are read from storage at upload time). Requires cloud storage — a large file (already past
41+
* the inline base64 cap) cannot be sent without it, so the request fails with a clear error.
4242
*
4343
* Runs for every request in {@link executeProviderRequest} (after the API key resolves), so
4444
* the server-only handle fields are first cleared on every file for every provider — a forged
@@ -72,9 +72,11 @@ export async function attachLargeFileRemoteUrls(
7272

7373
if (!StorageService.hasCloudStorage()) {
7474
logger.warn(
75-
`[${requestId}] "${file.name}" exceeds the inline limit for "${providerId}" but cloud storage is unavailable; it cannot be sent`
75+
`[${requestId}] "${file.name}" exceeds the inline limit for "${providerId}" but cloud storage is unavailable`
76+
)
77+
throw new Error(
78+
`File "${file.name}" exceeds the inline attachment limit and requires cloud file storage, which is not configured`
7679
)
77-
continue
7880
}
7981

8082
if (!request.userId) {

0 commit comments

Comments
 (0)