mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(model): report malformed GGUF and Safetensors headers as invalid_format through ParseFailure (#10667)
* refactor(model): report GGUF and Safetensors format failures through ParseFailure * fix(model): report malformed model headers as invalid_format through the shared mapping Malformed and truncated GGUF and Safetensors headers now take the shared ParseFailure mapping (invalid_request, invalid_format on path) instead of the model provider's own BinaryTargetError file_format_rejected. Unsupported forms stay unsupported_target and model allowances keep their resource-constraint recovery.
This commit is contained in:
1 parent
2705aad365
commit
a22fb6e60b
9 files changed
+160
-136
No files matched your search
@@ -3,7 +3,7 @@ import type { FileHandle } from "node:fs/promises";
|
||||
import { assertArtifactReadActive } from "../artifacts/ArtifactFileOperation.js";
|
||||
import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";
|
||||
import {
|
||||
ModelFormatFailure,
|
||||
modelCapacityFailure,
|
||||
MODEL_HEADER_BYTES,
|
||||
rejectModel,
|
||||
} from "./ModelFormat.js";
|
||||
@@ -58,10 +58,9 @@ export class ModelHeaderReader {
|
||||
if (!Number.isSafeInteger(end) || end < 0 || end > this.size)
|
||||
rejectModel("Declared header extent is outside the file");
|
||||
if (end - this.#headerPrefixBytes > MODEL_HEADER_BYTES)
|
||||
throw new ModelFormatFailure(
|
||||
"capacity",
|
||||
"Model header exceeds 100,000,000 bytes. This release has no runtime override.",
|
||||
throw modelCapacityFailure(
|
||||
"header-bytes",
|
||||
"Model header exceeds 100,000,000 bytes. This release has no runtime override.",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user