lutzroeder/netron · error · Error
File not found '${file}'.
Error message
File not found '${file}'. What it means
Thrown by the browser host's memory-backed archive/session when fetch() is called for a key that is not present in the in-memory blob map. The library looks up files by their stored identifier (e.g. an ONNX/protobuf external-data file name) and refuses to proceed if no blob with that exact key was registered. It is the browser equivalent of a missing file on disk.
Source
Thrown at source/browser.js:654
get identifier() {
return this._file.name;
}
get stream() {
return this._stream;
}
async asset(file) {
return this._host.asset(file);
}
async fetch(file, encoding, basename) {
if (basename !== undefined) {
return this._host.fetch(file, encoding, basename);
}
const blob = this._blobs[file];
if (!blob) {
throw new Error(`File not found '${file}'.`);
}
return new Promise((resolve, reject) => {
const window = this._host.window;
const reader = new window.FileReader();
const size = 0x10000000;
let position = 0;
const chunks = [];
reader.onload = (e) => {
if (encoding) {
resolve(e.target.result);
} else {
const buffer = new Uint8Array(e.target.result);
if (position === 0 && buffer.length === blob.size) {
const stream = new base.BinaryStream(buffer);
resolve(stream);
} else {
chunks.push(buffer);
position += buffer.length;View on GitHub (pinned to d8a543f5f8)
Solutions
- Verify the exact file name string the model metadata references and pass the same key when registering the blob
- If the model uses external data files, load every referenced companion file into the session before opening the model
- Check for path normalization mismatches (leading './', backslashes vs forward slashes, case) between the stored key and the requested key
- If the file should already exist, inspect the blob map keys (e.g. log Object.keys of the session files) to see what is actually registered
Example fix
// before
const model = await context.open('model.onnx'); // model references 'weights.onnx' not loaded
// after
await context.open('model.onnx', ['weights.onnx']); // supply referenced external files too Defensive patterns
Strategy: validation
Validate before calling
// Before opening, ensure every referenced file exists in the session
const required = ['model.onnx', 'weights.onnx'];
const missing = required.filter((f) => !context.has(f)); // or check session blob keys
if (missing.length) {
await context.request(missing); // prompt user / fetch blobs
} Try / catch
try {
const model = await context.open('model.onnx');
} catch (e) {
if (/File not found/.test(e.message)) {
// surface an upload prompt for the missing file name parsed from e.message
const missing = e.message.match(/'(.*)'/)?.[1];
showFileDialog(missing);
} else throw e;
} Prevention
- Register all external-data companion files before opening the model
- Normalize file names (strip './', unify slashes, match case) when storing blobs
- Log available blob keys when a lookup fails to catch naming mismatches early
When it happens
Trigger: Calling context.fetch(file) / session.fetch(file) (directly or indirectly by a model loader resolving external data references) with a file name that was never added to the browser session's blob store, or with a name whose case/path separators differ from the key it was stored under.
Common situations: Loading a model that references external weight files (e.g. ONNX external_data) while only supplying the main .onnx/.pb file; uploading a manifest plus files whose names don't byte-for-byte match the references; loading an archive where the entry path has a leading './' or different case sensitivity.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27).
Data as JSON: /api/errors/abf51941f1eab952.
Report an issue: GitHub.