Cannot retrieve the full file content
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
レポートにはリポジトリのファイルもテストも記載されていないため、まず、提供された Java メソッドと wget コマンドを使用して Files content endpoint 経由のダウンロードを再現します。クライアントが中断されたレスポンスを処理する箇所を追跡し、受信サイズを Content-Length と比較します。完全な出力ファイルが途中で終了することなく取得できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I use this API to create a batch embedding task:
https://api.openai.com/v1/batches
After the task is completed, download the embedding result file based on the output_file_id using the following API:
https://api.openai.com/v1/files/{file_id}/content
Recently, the project ran into an issue. After investigation, it was found that the problem was caused by incomplete downloaded files resulting in missing data.
The program was set to request 5,000 items per batch, but the result file downloaded locally contained only a few hundred items and showed the following message:
Premature end of Content-Length delimited message body (expected: 391505535; received: 113446592
I also tried to retrieve the result file in chunks, but it still failed and I could only get partial data.
The following is the Java code I originally used to download the file. Before this, this method was able to download the result file completely.
public static int downloadFile(String outputFilePath, String url, Map<String, String> headers) throws IOException {
HttpGet request = new HttpGet(url);
if (headers != null) {
headers.forEach(request::addHeader);
}
CloseableHttpResponse execute = httpClient.execute(request);
int statusCode = execute.getStatusLine().getStatusCode();
HttpEntity entity = execute.getEntity();
InputStream content = entity.getContent();
try (FileOutputStream outputStream = new FileOutputStream(outputFilePath)) {
byte[] buffer = new byte[8192];
int bytesRead;
while ((bytesRead = content.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
System.out.println("File downloaded to: " + outputFilePath);
} catch (IOException e) {
System.err.println("Error writing to file: " + e.getMessage());
} finally {
try {
content.close();
} catch (IOException e) {
System.err.println("Error closing input stream: " + e.getMessage());
}
}
return statusCode;
}
I tried testing the download on the server using wget. After downloading part of the file, it would close and then retry, repeating in a loop.
[root@scripts]# wget --header="Authorization: Bearer token" \
> -O file.jsonl \
> https://api.openai.com/v1/files/{fileId}/content
--2025-11-13 02:59:44-- https://api.openai.com/v1/files/{fileId}/content
Resolving api.openai.com (api.openai.com)... 162.159.140.245, 172.66.0.243
Connecting to api.openai.com (api.openai.com)|162.159.140.245|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 730814739 (697M) [application/octet-stream]
Saving to: ‘file.jsonl’
file.jsonl 10%[===============> ] 73.76M 25.1MB/s in 2.9s
2025-11-13 03:00:33 (25.1 MB/s) - Connection closed at byte 77340672. Retrying.
--2025-11-13 03:00:36-- (try: 2) https://api.openai.com/v1/files/{fileId}/content
Connecting to api.openai.com (api.openai.com)|162.159.140.245|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 730814739 (697M) [application/octet-stream]
Saving to: ‘file.jsonl’
file.jsonl 3%[====> ] 23.03M 24.7MB/s in 0.9s
2025-11-13 03:00:51 (24.7 MB/s) - Connection closed at byte 77340672. Retrying.
--2025-11-13 03:00:55-- (try: 3) https://api.openai.com/v1/files/{fileId}/content
Connecting to api.openai.com (api.openai.com)|162.159.140.245|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 730814739 (697M) [application/octet-stream]
Saving to: ‘file.jsonl’
file.jsonl 6%[========> ] 42.78M 19.3MB/s in 2.2s
2025-11-13 03:01:10 (19.3 MB/s) - Connection closed at byte 77340672. Retrying.
HTTP request sent, awaiting response... ^C
[root@scripts]# wc -l file.jsonl
851 file.jsonl
- 主要言語
- Kotlin
- スター
- 1.5k
- フォーク
- 268
- 平均マージ
- 11時間 31分
- マージ済み PR(30日)
- 150
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/openai-java のほかの issue
-
HttpRequest.url() logs spaces in path segments as literal plus signs対応中かも @sylvesterkaczmarek が 56 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openai/openai-java#886 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Make diarized transcription duration and task optional対応中かも @wskr00 が 87 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
openai/openai-java#802 · コメント 2 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
openai/openai-java#1175 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 半日 初心者へのやさしさ 42/100
openai/openai-java#1160 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
openai/openai-java#956 ·
メンテナーはふだん 1 日以内に返信
openai/openai-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
fix: retain the best partial noise-correction solution対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
world-federation-of-advertisers/cross-media-measurement#4653 ·
メンテナーはふだん 1 日以内に返信
-
enhancement help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
kabirvashisht4-glitch/Vet#22 ·
-
documentation good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
djazairdev/wilayas#23 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
lysine-dev/okhttp#9788 ·
メンテナーはふだん 1 日以内に返信