{"record":{"id":"e841f2fdee9d4f68","repo":"headroomlabs-ai/headroom","slug":"no-loadable-onnx-artifact-in-model-id-tried-o","errorCode":null,"errorMessage":"No loadable ONNX artifact in {model_id}; tried {_onnx_filename_candidates()}","messagePattern":"No loadable ONNX artifact in (.+?); tried (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"headroom/transforms/kompress_compressor.py","lineNumber":686,"sourceCode":"        try:\n            session = ort.InferenceSession(\n                onnx_path,\n                _onnx_session_options(ort),\n                providers=providers,\n            )\n            _smoke_run(session)\n            return session\n        except Exception as exc:\n            last_err = exc\n            logger.warning(\n                \"ONNX artifact %r from %s is unusable (%s); trying next candidate\",\n                filename,\n                model_id,\n                exc,\n            )\n    if not allow_download and cache_miss:\n        raise KompressModelNotCached(model_id) from last_err\n    raise FileNotFoundError(\n        f\"No loadable ONNX artifact in {model_id}; tried {_onnx_filename_candidates()}\"\n    ) from last_err\n\n\ndef _load_kompress_onnx(\n    model_id: str,\n    *,\n    use_coreml: bool = False,\n    allow_download: bool = True,\n) -> tuple[Any, Any, str]:\n    \"\"\"Download ONNX INT8 model from HuggingFace and load with onnxruntime.\n\n    When ``allow_download`` is ``False`` the model and tokenizer are loaded from\n    the local cache only; a cache miss raises :class:`KompressModelNotCached`\n    instead of hitting the network.\n    \"\"\"\n    with _kompress_lock:\n        if model_id in _kompress_cache:","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/transforms/kompress_compressor.py#L668-L704","documentation":"Terminal FileNotFoundError from the ONNX candidate loop in _load_kompress_pytorch's sibling loader: every candidate filename from _onnx_filename_candidates() was tried and each either failed to download, failed InferenceSession load, or failed the _smoke_run — and since downloading was allowed (or the failure was not a pure cache miss), the loop exits with this aggregated error chaining the last underlying exception. Notably, some onnxruntime builds accept an int8 MatMulNBits model at load but reject it at execution; the smoke run catches that and falls through, so a restrictive ORT build can exhaust all candidates.","triggerScenarios":"Loading Kompress ONNX when: the HuggingFace repo lacks/removed the ONNX artifacts, network access fails for every candidate, or the installed onnxruntime cannot execute any offered artifact (int8 contrib op unsupported and fp32 candidate also unavailable).","commonSituations":"Old/limited onnxruntime builds (no contrib ops), corporate proxies blocking HF downloads, a model repo revision that dropped ONNX files, corrupted partial downloads.","solutions":["Check the chained cause (raise.from last_err) — it tells you whether it was network, missing file, or ORT execution failure.","Upgrade onnxruntime to a build supporting MatMulNBits contrib ops, then retry.","Verify network/egress to huggingface.co and that the model repo still ships the ONNX filenames listed in the error.","Fall back to the PyTorch loader (ensure torch is installed) — the top-level loader already tries this, so a torch install fixes the end-to-end path."],"exampleFix":"# before\nsession = _load_kompress_pytorch_session(model_id)  # FileNotFoundError\n\n# after\ntry:\n    session = load_kompress_model(model_id, prefer_backend=\"onnx\")\nexcept FileNotFoundError:\n    session = load_kompress_model(model_id, prefer_backend=\"torch\")  # needs torch installed","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    session = load_kompress_model(model_id, backend=\"onnx\")\nexcept FileNotFoundError as e:\n    logger.warning(\"ONNX unusable (%s); trying PyTorch\", e)\n    session = load_kompress_model(model_id, backend=\"torch\")","preventionTips":["Install onnxruntime builds that support MatMulNBits contrib ops (or keep torch as fallback).","Verify HF egress and repo contents (ONNX filenames) before deploying offline.","Inspect the chained exception — it distinguishes network vs load vs smoke-run failure."],"tags":["onnx","onnxruntime","model-loading","network","huggingface"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}