{"record":{"id":"fffe6dc24ce95f9c","repo":"abhigyanpatwari/GitNexus","slug":"failed-to-download-embedding-model-errmsg-n-endpointhint","errorCode":null,"errorMessage":"Failed to download embedding model: ${errMsg}\\n  ${endpointHint}","messagePattern":"Failed to download embedding model: (.+?)\\\\n  (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/embeddings/embedding-local-init.ts","lineNumber":173,"sourceCode":"          currentDevice = device;\n          activeDimensions = finalConfig.dimensions;\n\n          if (isDev) {\n            logger.info(`✅ Using ${formatDeviceLabel(device)} backend`);\n            logger.info('✅ Embedding model loaded successfully');\n          }\n\n          return embedderInstance!;\n        } catch (deviceError) {\n          const errMsg = deviceError instanceof Error ? deviceError.message : String(deviceError);\n          if (isHfDownloadFailure(errMsg)) {\n            const endpointHint = process.env.HF_ENDPOINT\n              ? `The configured endpoint (${process.env.HF_ENDPOINT}) may be unreachable.`\n              : `huggingface.co may be unreachable from your network.\\n` +\n                `  Set HF_ENDPOINT to a mirror and retry:\\n` +\n                `    HF_ENDPOINT=https://hf-mirror.com npx gitnexus analyze --embeddings\\n` +\n                `    (Windows: set HF_ENDPOINT=https://hf-mirror.com && npx gitnexus analyze --embeddings)`;\n            throw new Error(`Failed to download embedding model: ${errMsg}\\n  ${endpointHint}`);\n          }\n          if (isDev && (device === 'cuda' || device === 'dml')) {\n            const gpuType = device === 'dml' ? 'DirectML' : 'CUDA';\n            logger.info(`⚠️  ${gpuType} not available, falling back to CPU...`);\n          }\n          if (device === devicesToTry[devicesToTry.length - 1]) {\n            throw deviceError;\n          }\n        }\n      }\n\n      throw new Error('No suitable device found for embedding model');\n    } catch (error) {\n      initPromise = null;\n      embedderInstance = null;\n      throw error;\n    }\n  })();","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/embeddings/embedding-local-init.ts#L155-L191","documentation":"initLocalEmbedder throws this when downloading the embedding model weights from Hugging Face fails. The message includes the underlying error and a network-specific hint: if HF_ENDPOINT is set, that mirror may be unreachable; otherwise it suggests huggingface.co is unreachable and shows exact HF_ENDPOINT mirror commands for unix and Windows.","triggerScenarios":"Calling initLocalEmbedder() (directly or via analyze --embeddings / embeddings sync) when the transformers.js pipeline cannot fetch model files from the configured endpoint — DNS failure, firewall, offline machine, or an unreachable HF_ENDPOINT mirror.","commonSituations":"Corporate networks/firewalls blocking huggingface.co; regions where HF is throttled; typos in a custom HF_ENDPOINT; CI runners without internet egress.","solutions":["If a custom HF_ENDPOINT is set, verify it is reachable (curl it) or unset it to fall back to huggingface.co.","Set a reachable mirror and retry: HF_ENDPOINT=https://hf-mirror.com npx gitnexus analyze --embeddings (Windows: set HF_ENDPOINT=https://hf-mirror.com && ...).","Fix network egress / proxy settings (e.g. GLOBAL_AGENT_HTTPS_PROXY) so the endpoint is reachable.","Pre-populate the model cache from a machine with access, or use GITNEXUS_EMBEDDING_URL HTTP embedding to avoid model download."],"exampleFix":"// before: blocked by firewall\nnpx gitnexus analyze --embeddings\n// after: use a mirror\nexport HF_ENDPOINT=https://hf-mirror.com\nnpx gitnexus analyze --embeddings","handlingStrategy":"retry","validationCode":"// check endpoint reachability before init\nconst ep = process.env.HF_ENDPOINT ?? 'https://huggingface.co';\nconst ok = await fetch(ep, { method: 'HEAD' }).then(r => r.ok).catch(() => false);\nif (!ok) console.warn(`Model endpoint ${ep} unreachable; set HF_ENDPOINT to a mirror`);","typeGuard":null,"tryCatchPattern":"try {\n  await initLocalEmbedder();\n} catch (err) {\n  if (String(err.message).startsWith('Failed to download embedding model')) {\n    // set HF_ENDPOINT mirror and retry, or switch to HTTP embedding\n  }\n}","preventionTips":["Set HF_ENDPOINT to a reachable mirror in restricted networks before first run","Warm the model cache on a machine with internet access and reuse it","Configure proxy env vars (GLOBAL_AGENT_HTTPS_PROXY) for corporate networks","Use GITNEXUS_EMBEDDING_URL HTTP embedding when egress to HF is impossible"],"tags":["network","embedding","model-download","huggingface"],"backgroundTag":"network-request-failed","analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-09-15T23:29:44.066Z","contentChangedAt":"2026-09-15T23:29:44.066Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}