{"record":{"id":"2cdf3ec625d28269","repo":"lfnovo/open-notebook","slug":"model-is-not-a-languagemodel-model-please-chec","errorCode":null,"errorMessage":"Model is not a LanguageModel: {model}. Please check that the model configured for '{default_type}' is a language model, not an embedding or speech model.","messagePattern":"Model is not a LanguageModel: (.+?)\\. Please check that the model configured for '(.+?)' is a language model, not an embedding or speech model\\.","errorType":"exception","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"open_notebook/ai/provision.py","lineNumber":56,"sourceCode":"    if model is None:\n        logger.error(\n            f\"Model provisioning failed: No model found. \"\n            f\"Selection reason: {selection_reason}. \"\n            f\"model_id={model_id}, default_type={default_type}. \"\n            f\"Please check Settings → Models and ensure a default model is configured for '{default_type}'.\"\n        )\n        raise ConfigurationError(\n            f\"No model configured for {selection_reason}. \"\n            f\"Please go to Settings → Models and configure a default model for '{default_type}'.\"\n        )\n\n    if not isinstance(model, LanguageModel):\n        logger.error(\n            f\"Model type mismatch: Expected LanguageModel but got {type(model).__name__}. \"\n            f\"Selection reason: {selection_reason}. \"\n            f\"model_id={model_id}, default_type={default_type}.\"\n        )\n        raise ConfigurationError(\n            f\"Model is not a LanguageModel: {model}. \"\n            f\"Please check that the model configured for '{default_type}' is a language model, not an embedding or speech model.\"\n        )\n\n    return model.to_langchain()\n","sourceCodeStart":38,"sourceCodeEnd":62,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/open_notebook/ai/provision.py#L38-L62","documentation":"provision_langchain_model() found a model but isinstance(model, LanguageModel) failed — the slot configured for language generation actually holds an embedding or speech-to-text model. The code refuses to call to_langchain() on a non-chat model to avoid runtime type errors downstream in LangChain.","triggerScenarios":"Assigning an embedding model (e.g. OpenAI text-embedding-3) as the default language model in Settings → Models; programmatic updates to DefaultModels that store the wrong model id in default_language_model.","commonSituations":"Users pasting/configuring model ids quickly and mixing up slots; bulk-importing model configs; provider UIs listing all model types in one picker so an embedding model gets selected as the chat default.","solutions":["Open Settings → Models and set the '{default_type}' slot to an actual language/chat model","Check the model row's type field in the database matches 'language' for that slot","If configuring via API/script, validate model.type == 'language' before saving it as default"],"exampleFix":"// before\ndefaults.default_language_model = embedding_model.id\n// after\ndefaults.default_language_model = language_model.id  # model.type == 'language'","handlingStrategy":"type-guard","validationCode":"defaults = await model_manager.get_defaults()\nm = await model_manager.get_model(defaults.default_language_model)\nif not m or m.type != 'language':\n    raise ConfigurationError('default language model slot must hold a language model')","typeGuard":"def is_language_model(m) -> bool:\n    return getattr(m, 'type', None) == 'language' or isinstance(m, LanguageModel)","tryCatchPattern":"try:\n    model = await provision_langchain_model(...)\nexcept ConfigurationError as e:\n    if 'not a LanguageModel' in str(e):\n        return JSONResponse(409, 'Wrong model type in default slot')\n    raise","preventionTips":["Validate model.type matches the slot when saving settings, not just at call time","Group the model picker by type (language/embedding/speech) in the UI","Add a smoke test that provisions each default slot at startup"],"tags":["configuration","models","type-mismatch","llm"],"backgroundTag":"wrong-model-type-configured","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}