{"record":{"id":"55a59dde1889f45a","repo":"lfnovo/open-notebook","slug":"no-model-configured-for-selection-reason-please","errorCode":null,"errorMessage":"No model configured for {selection_reason}. Please go to Settings → Models and configure a default model for '{default_type}'.","messagePattern":"No model configured for (.+?)\\. Please go to Settings → Models and configure a default model for '(.+?)'\\.","errorType":"exception","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"open_notebook/ai/provision.py","lineNumber":45,"sourceCode":"        )\n        model = await model_manager.get_default_model(\"large_context\", **kwargs)\n    elif model_id:\n        selection_reason = f\"explicit model_id={model_id}\"\n        model = await model_manager.get_model(model_id, **kwargs)\n    else:\n        selection_reason = f\"default for type={default_type}\"\n        model = await model_manager.get_default_model(default_type, **kwargs)\n\n    logger.debug(f\"Using model: {model}\")\n\n    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":27,"sourceCodeEnd":62,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/open_notebook/ai/provision.py#L27-L62","documentation":"provision_langchain_model() resolves a model by id or default_type and found none — no LanguageModel row matches. It means the requested default model slot (e.g. 'language' or a specific override) is unconfigured or points to a deleted model, so no LLM can be provisioned for the AI call.","triggerScenarios":"Calling any chat/answer endpoint (provide_answer, call_model, write_final_answer, content_process) when Settings → Models has no default language model set, or when the configured default model id was deleted from the database while still referenced.","commonSituations":"Fresh setup where the user imported content but never configured models; a model was deleted via the Models settings page leaving a dangling default_model id; multi-provider setups where the default points at a provider whose credentials were removed.","solutions":["Go to Settings → Models and set a default language model for the '{default_type}' slot","If a default is set but stale, re-select a valid model (the referenced id may have been deleted)","Verify the model's provider has valid API credentials so it appears as available"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from open_notebook.ai.models import model_manager\nm = await model_manager.get_default_model('language')\nif m is None:\n    raise HTTPException(409, 'Configure a default language model in Settings → Models')","typeGuard":null,"tryCatchPattern":"try:\n    model = await provision_langchain_model(...)\nexcept ConfigurationError as e:\n    return JSONResponse(status_code=409, content={'detail': str(e), 'hint': 'Settings → Models'})","preventionTips":["On first-run onboarding, require models to be configured before enabling chat features","Audit defaults after deleting any model row","Surface a preflight 'models configured' check in the UI before long-running AI jobs"],"tags":["configuration","models","llm","provisioning"],"backgroundTag":"missing-default-model-config","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}