{"record":{"id":"952ed196c7d622a4","repo":"chatboxai/chatbox","slug":"session-attachment-embedding-model-not-set","errorCode":null,"errorMessage":"session attachment embedding model not set","messagePattern":"session attachment embedding model not set","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/session-attachment-rag/model-providers.ts","lineNumber":33,"sourceCode":"const SESSION_ATTACHMENT_EMBEDDING_MODEL = 'chatbox-ai:text-embedding-3-small'\n\nexport type SessionAttachmentEmbeddingProviderResolution = {\n  provider: EmbeddingModel\n  modelString: string\n  source: 'chatbox-ai-license' | 'default-embedding-model'\n}\n\nexport async function getSessionAttachmentEmbeddingProviderWithResolution(): Promise<SessionAttachmentEmbeddingProviderResolution> {\n  const settings = getSettings()\n  const hasLicense = Boolean(store.get('settings.licenseKey'))\n  const defaultEmbeddingModel = getDefaultEmbeddingModelString(settings)\n  const embeddingModel = defaultEmbeddingModel || (hasLicense ? SESSION_ATTACHMENT_EMBEDDING_MODEL : undefined)\n  const source: SessionAttachmentEmbeddingProviderResolution['source'] = defaultEmbeddingModel\n    ? 'default-embedding-model'\n    : 'chatbox-ai-license'\n\n  if (!embeddingModel) {\n    throw new Error('session attachment embedding model not set')\n  }\n\n  try {\n    const provider = await createEmbeddingProviderFromModelString(embeddingModel)\n    return {\n      provider,\n      modelString: embeddingModel,\n      source,\n    }\n  } catch (error) {\n    log.error(`[MODEL] Failed to resolve session attachment embedding provider: ${embeddingModel}`, error)\n    sentry.withScope((scope) => {\n      scope.setTag('component', 'session-attachment-rag-model')\n      scope.setTag('operation', 'get_embedding_provider')\n      scope.setExtra('embeddingModel', embeddingModel)\n      sentry.captureException(error)\n    })\n    throw error","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/main/session-attachment-rag/model-providers.ts#L15-L51","documentation":"Thrown by getSessionAttachmentEmbeddingProviderWithResolution when no embedding model can be resolved: getDefaultEmbeddingModelString(settings) is empty AND there is no license key (so the chatbox-ai fallback SESSION_ATTACHMENT_EMBEDDING_MODEL='chatbox-ai:text-embedding-3-small' is also unavailable). Embeddings are mandatory for RAG indexing, so the pipeline cannot proceed.","triggerScenarios":"User has not configured a default embedding model in settings AND has no settings.licenseKey; settings is freshly initialized; the license key was cleared after attachment RAG was enabled.","commonSituations":"First-time use of session-attachment RAG with no provider configured; license expired/removed; settings reset; user disabled the default embedding provider.","solutions":["Configure a default embedding model via settings (getDefaultEmbeddingModelString must return a value).","Activate a chatbox-ai license (store 'settings.licenseKey') to unlock the built-in text-embedding-3-small fallback.","Surface a setup prompt before triggering attachment indexing rather than letting processing fail.","If a default was configured, verify getDefaultEmbeddingModelString reads the right settings key after a settings migration."],"exampleFix":"// before\nif (!embeddingModel) throw new Error('session attachment embedding model not set')\n\n// caller\nlet provider\ntry { provider = await getSessionAttachmentEmbeddingProviderWithResolution() }\ncatch (e) { promptUserToConfigureEmbeddings(); return }","handlingStrategy":"validation","validationCode":"const hasLicense = Boolean(store.get('settings.licenseKey'))\nconst hasDefault = getDefaultEmbeddingModelString(getSettings())\nif (!hasLicense && !hasDefault) { promptConfigureEmbeddings(); return }","typeGuard":"function isEmbeddingModelUnset(e: unknown): e is Error { return e instanceof Error && e.message === 'session attachment embedding model not set' }","tryCatchPattern":"try { return await getSessionAttachmentEmbeddingProviderWithResolution() } catch (e) { if (isEmbeddingModelUnset(e)) { ui.promptConfigureEmbeddings(); return null } throw e }","preventionTips":["Configure a default embedding model or activate a license before enabling attachment RAG.","Block 'index attachment' actions until an embedding source is available.","Re-check after license/settings changes."],"tags":["session-attachment-rag","configuration","embeddings","typescript"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}