{"record":{"id":"4de98906543e5bae","repo":"abhigyanpatwari/GitNexus","slug":"getembedder-is-not-available-in-http-embedding-m","errorCode":null,"errorMessage":"getEmbedder() is not available in HTTP embedding mode. Use embedText()/embedBatch() instead.","messagePattern":"getEmbedder\\(\\) is not available in HTTP embedding mode\\. Use embedText\\(\\)/embedBatch\\(\\) instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/embeddings/embedder.ts","lineNumber":289,"sourceCode":"};\n\n/**\n * Get the effective embedding dimensions.\n * In HTTP mode, uses GITNEXUS_EMBEDDING_DIMS if set, otherwise the default.\n */\nexport const getEmbeddingDimensions = (): number => {\n  if (isHttpMode()) {\n    return getHttpDimensions() ?? DEFAULT_EMBEDDING_CONFIG.dimensions;\n  }\n  return DEFAULT_EMBEDDING_CONFIG.dimensions;\n};\n\n/**\n * Get the embedder instance (throws if not initialized)\n */\nexport const getEmbedder = (): FeatureExtractionPipeline => {\n  if (isHttpMode()) {\n    throw new Error(\n      'getEmbedder() is not available in HTTP embedding mode. Use embedText()/embedBatch() instead.',\n    );\n  }\n  if (!embedderInstance) {\n    throw new Error('Embedder not initialized. Call initEmbedder() first.');\n  }\n  return embedderInstance;\n};\n\n/**\n * Embed a single text string\n *\n * @param text - Text to embed\n * @returns Float32Array of embedding vector\n */\nexport const embedText = async (\n  text: string,\n  options: EmbeddingRequestOptions = {},","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/embeddings/embedder.ts#L271-L307","documentation":"Thrown by getEmbedder() when isHttpMode() is true. getEmbedder() returns the local transformers.js pipeline singleton, which is never loaded in HTTP mode; embedText()/embedBatch() dispatch to httpEmbed() instead. The guard prevents callers from reaching the !embedderInstance branch (error 109) with a confusing message when the real issue is that they are in HTTP mode and should not be calling getEmbedder() at all.","triggerScenarios":"Custom integration code that calls getEmbedder() directly (rather than embedText/embedBatch) while GITNEXUS_EMBEDDING_URL and GITNEXUS_EMBEDDING_MODEL are both set. The core embedText()/embedBatch() paths check isHttpMode() themselves and never call getEmbedder() in HTTP mode.","commonSituations":"A fork or plugin that holds a reference to the local pipeline for custom inference; migrating to HTTP mode without updating direct getEmbedder() call sites; an MCP tool that exposes the raw pipeline.","solutions":["Replace getEmbedder() with embedText()/embedBatch() — they work in both HTTP and local modes.","Gate direct pipeline access on !isHttpMode() and provide an HTTP-mode branch.","If you truly need the pipeline object, you are in local mode — unset the HTTP env vars."],"exampleFix":"// before\nconst pipe = getEmbedder();\nconst out = await pipe(text, { pooling: 'mean', normalize: true });\n// after\nconst vec = await embedText(text);","handlingStrategy":"type-guard","validationCode":"import { isHttpMode } from 'gitnexus/src/core/embeddings/http-client.js';\n// Never call getEmbedder() in HTTP mode.\nconst pipe = isHttpMode() ? null : getEmbedder();","typeGuard":"import { isHttpMode } from 'gitnexus/src/core/embeddings/http-client.js';\nconst canUseLocalPipelineHandle = (): boolean => !isHttpMode();","tryCatchPattern":null,"preventionTips":["Use embedText()/embedBatch() instead of getEmbedder() — they handle both modes.","If you need the raw pipeline, ensure you are not in HTTP mode (unset the URL/MODEL env vars)."],"tags":["embeddings","http-mode","api-misuse"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}