{"record":{"id":"abf51941f1eab952","repo":"lutzroeder/netron","slug":"file-not-found-file","errorCode":null,"errorMessage":"File not found '${file}'.","messagePattern":"File not found '(.+?)'\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"source/browser.js","lineNumber":654,"sourceCode":"    get identifier() {\n        return this._file.name;\n    }\n\n    get stream() {\n        return this._stream;\n    }\n\n    async asset(file) {\n        return this._host.asset(file);\n    }\n\n    async fetch(file, encoding, basename) {\n        if (basename !== undefined) {\n            return this._host.fetch(file, encoding, basename);\n        }\n        const blob = this._blobs[file];\n        if (!blob) {\n            throw new Error(`File not found '${file}'.`);\n        }\n        return new Promise((resolve, reject) => {\n            const window = this._host.window;\n            const reader = new window.FileReader();\n            const size = 0x10000000;\n            let position = 0;\n            const chunks = [];\n            reader.onload = (e) => {\n                if (encoding) {\n                    resolve(e.target.result);\n                } else {\n                    const buffer = new Uint8Array(e.target.result);\n                    if (position === 0 && buffer.length === blob.size) {\n                        const stream = new base.BinaryStream(buffer);\n                        resolve(stream);\n                    } else {\n                        chunks.push(buffer);\n                        position += buffer.length;","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/lutzroeder/netron/blob/d8a543f5f847ef596aa58858d6adcf5d75545f7f/source/browser.js#L636-L672","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst model = await context.open('model.onnx'); // model references 'weights.onnx' not loaded\n\n// after\nawait context.open('model.onnx', ['weights.onnx']); // supply referenced external files too","handlingStrategy":"validation","validationCode":"// Before opening, ensure every referenced file exists in the session\nconst required = ['model.onnx', 'weights.onnx'];\nconst missing = required.filter((f) => !context.has(f)); // or check session blob keys\nif (missing.length) {\n  await context.request(missing); // prompt user / fetch blobs\n}","typeGuard":null,"tryCatchPattern":"try {\n  const model = await context.open('model.onnx');\n} catch (e) {\n  if (/File not found/.test(e.message)) {\n    // surface an upload prompt for the missing file name parsed from e.message\n    const missing = e.message.match(/'(.*)'/)?.[1];\n    showFileDialog(missing);\n  } else throw e;\n}","preventionTips":["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"],"tags":["browser","file-not-found","external-data","model-loading"],"backgroundTag":"file-not-found","analyzedSha":"d8a543f5f847ef596aa58858d6adcf5d75545f7f","analyzedAt":"2026-08-27T19:21:42.082Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}