{"record":{"id":"0ca5c13c70556d02","repo":"xtekky/gpt4free","slug":"wasm-file-not-found-wasm-path","errorCode":null,"errorMessage":"WASM file not found: {wasm_path}","messagePattern":"WASM file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"g4f/Provider/needs_auth/DeepSeek.py","lineNumber":61,"sourceCode":"    has_curl_cffi = False\n\nWASM_PATH = os.path.join(os.path.dirname(__file__), \"deepseek\", \"pow_solver.wasm\")\n\n\nclass DeepSeekHash:\n    \"\"\"Custom SHA3 hash solver using WebAssembly\"\"\"\n\n    def __init__(self):\n        self.instance = None\n        self.memory = None\n        self.store = None\n\n    def init(self, wasm_path: str):\n        if not has_wasmtime_and_numpy:\n            raise ImportError(\"wasmtime and numpy are required for PoW solving\")\n\n        if not Path(wasm_path).exists():\n            raise FileNotFoundError(f\"WASM file not found: {wasm_path}\")\n\n        engine = wasmtime.Engine()\n\n        with open(wasm_path, \"rb\") as f:\n            wasm_bytes = f.read()\n\n        module = wasmtime.Module(engine, wasm_bytes)\n\n        self.store = wasmtime.Store(engine)\n        linker = wasmtime.Linker(engine)\n        linker.define_wasi()\n\n        self.instance = linker.instantiate(self.store, module)\n        self.memory = self.instance.exports(self.store)[\"memory\"]\n\n        return self\n\n    def _write_to_memory(self, text: str) -> tuple[int, int]:","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/Provider/needs_auth/DeepSeek.py#L43-L79","documentation":"FileNotFoundError raised by DeepSeekHash.init when the WASM module file that implements DeepSeek's SHA3 proof-of-work solver does not exist at the given wasm_path. The dependency check passed, but the binary asset is missing from disk, so the wasmtime engine cannot be initialized.","triggerScenarios":"The provider ships/expects a .wasm asset next to the package, but it is absent — partial install, packaging that excluded binary assets, a custom wasm_path pointing at a moved/deleted file, or a source checkout without the asset.","commonSituations":"Installing g4f from a wheel/sdist that omitted the wasm asset; running from a trimmed Docker image where data files were pruned; passing a wrong wasm_path in custom code; version change that moved the asset.","solutions":["Reinstall g4f cleanly (pip install --force-reinstall g4f) so packaged data files including the .wasm are restored.","Verify the expected wasm file exists under the provider's resource directory and matches the version your code expects.","If passing a custom wasm_path, correct it to an existing file.","Report/pin the version if the release itself ships without the asset."],"exampleFix":"# before\nhasher.init(\"/wrong/path/sha3.wasm\")  # FileNotFoundError\n\n# after\nfrom pathlib import Path\nwasm = Path(__file__).parent / \"sha3.wasm\"\nassert wasm.exists(), f\"missing asset: {wasm}\"\nhasher.init(str(wasm))","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef wasm_asset_ok(wasm_path):\n    return Path(wasm_path).is_file()\n\nassert wasm_asset_ok(wasm_path), f\"WASM asset missing: {wasm_path}\"","typeGuard":null,"tryCatchPattern":"try:\n    hasher.init(wasm_path)\nexcept FileNotFoundError:\n    reinstall_or_restore_g4f_assets()","preventionTips":["Pin the g4f version and install from the official package so data files ship.","In Docker, avoid multi-stage copies that drop package data files.","Smoke-test provider initialization in CI to catch missing assets early."],"tags":["file-not-found","deepseek","wasm","packaging"],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}