chatboxai/chatbox · error · Error

session attachment embedding model not set

Error message

session attachment embedding model not set

What it means

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.

Source

Thrown at src/main/session-attachment-rag/model-providers.ts:33

const SESSION_ATTACHMENT_EMBEDDING_MODEL = 'chatbox-ai:text-embedding-3-small'

export type SessionAttachmentEmbeddingProviderResolution = {
  provider: EmbeddingModel
  modelString: string
  source: 'chatbox-ai-license' | 'default-embedding-model'
}

export async function getSessionAttachmentEmbeddingProviderWithResolution(): Promise<SessionAttachmentEmbeddingProviderResolution> {
  const settings = getSettings()
  const hasLicense = Boolean(store.get('settings.licenseKey'))
  const defaultEmbeddingModel = getDefaultEmbeddingModelString(settings)
  const embeddingModel = defaultEmbeddingModel || (hasLicense ? SESSION_ATTACHMENT_EMBEDDING_MODEL : undefined)
  const source: SessionAttachmentEmbeddingProviderResolution['source'] = defaultEmbeddingModel
    ? 'default-embedding-model'
    : 'chatbox-ai-license'

  if (!embeddingModel) {
    throw new Error('session attachment embedding model not set')
  }

  try {
    const provider = await createEmbeddingProviderFromModelString(embeddingModel)
    return {
      provider,
      modelString: embeddingModel,
      source,
    }
  } catch (error) {
    log.error(`[MODEL] Failed to resolve session attachment embedding provider: ${embeddingModel}`, error)
    sentry.withScope((scope) => {
      scope.setTag('component', 'session-attachment-rag-model')
      scope.setTag('operation', 'get_embedding_provider')
      scope.setExtra('embeddingModel', embeddingModel)
      sentry.captureException(error)
    })
    throw error

View on GitHub (pinned to 81571269ad)

Solutions

  1. Configure a default embedding model via settings (getDefaultEmbeddingModelString must return a value).
  2. Activate a chatbox-ai license (store 'settings.licenseKey') to unlock the built-in text-embedding-3-small fallback.
  3. Surface a setup prompt before triggering attachment indexing rather than letting processing fail.
  4. If a default was configured, verify getDefaultEmbeddingModelString reads the right settings key after a settings migration.

Example fix

// before
if (!embeddingModel) throw new Error('session attachment embedding model not set')

// caller
let provider
try { provider = await getSessionAttachmentEmbeddingProviderWithResolution() }
catch (e) { promptUserToConfigureEmbeddings(); return }
Defensive patterns

Strategy: validation

Validate before calling

const hasLicense = Boolean(store.get('settings.licenseKey'))
const hasDefault = getDefaultEmbeddingModelString(getSettings())
if (!hasLicense && !hasDefault) { promptConfigureEmbeddings(); return }

Type guard

function isEmbeddingModelUnset(e: unknown): e is Error { return e instanceof Error && e.message === 'session attachment embedding model not set' }

Try / catch

try { return await getSessionAttachmentEmbeddingProviderWithResolution() } catch (e) { if (isEmbeddingModelUnset(e)) { ui.promptConfigureEmbeddings(); return null } throw e }

Prevention

When it happens

Trigger: 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.

Common situations: First-time use of session-attachment RAG with no provider configured; license expired/removed; settings reset; user disabled the default embedding provider.

Related errors


AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12). Data as JSON: /api/errors/952ed196c7d622a4. Report an issue: GitHub.