langgenius/dify · error · ProviderNotInitializeError
provider_not_initialize
provider_not_initialize
Error message
No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials.
What it means
HTTP 400 (code=provider_not_initialize) raised in _get_message_suggested_questions (message.py:523) when generating suggested questions throws ProviderTokenNotInitError. Suggested-questions generation calls an LLM, so the tenant must have at least one provider configured; with none, it fails. Catch maps to ProviderNotInitializeError.
Source
Thrown at api/controllers/console/app/message.py:523
def _get_message_suggested_questions(*, session: Session, current_user: Account, app_model: App, message_id: UUID):
message_id_str = str(message_id)
try:
questions = MessageService.get_suggested_questions_after_answer(
app_model=app_model,
message_id=message_id_str,
user=current_user,
invoke_from=InvokeFrom.DEBUGGER,
session=session,
)
except MessageNotExistsError:
raise NotFound("Message not found")
except ConversationNotExistsError:
raise NotFound("Conversation not found")
except ProviderTokenNotInitError as ex:
raise ProviderNotInitializeError(ex.description)
except QuotaExceededError:
raise ProviderQuotaExceededError()
except ModelCurrentlyNotSupportError:
raise ProviderModelCurrentlyNotSupportError()
except InvokeError as e:
raise CompletionRequestError(e.description)
except SuggestedQuestionsAfterAnswerDisabledError:
raise AppSuggestedQuestionsAfterAnswerDisabledError()
except Exception:
logger.exception("internal server error.")
raise InternalServerError()
return dump_response(SuggestedQuestionsResponse, {"data": questions})
def _get_message_detail(*, session: Session, app_model: App, message_id: UUID):
message_id_str = str(message_id)
View on GitHub (pinned to ef8544b173)
Solutions
- Configure at least one model provider under Settings -> Model Provider.
- Disable the 'suggested questions after answer' app feature until a provider is configured.
- Verify the default tenant model resolves to a configured provider before enabling the feature.
Defensive patterns
Strategy: validation
Validate before calling
async function ensureProviderReady() {
const res = await fetch('/console/api/workspaces/current/model-providers');
const data = await res.json();
const ok = data.data.some(p => p.is_valid);
if (!ok) throw new Error('configure a provider first');
}
await ensureProviderReady(); Try / catch
try {
await getSuggestedQuestions(appId, msgId);
} catch (e) {
if (e.code === 'provider_not_initialize') {
// route to Settings -> Model Provider; optionally disable feature
} else throw e;
} Prevention
- Disable suggested-questions-after-answer in app config until a provider is set up.
- Pre-check provider readiness before enabling the feature in the UI.
- Do not retry provider_not_initialize; it requires user action.
When it happens
Trigger: GET /console/api/apps/<app_id>/message/<message_id>/suggested-questions on a workspace with no model provider credentials configured.
Common situations: New self-hosted install that never set up a provider; tenant removed all provider configs; suggested-questions-after-answer enabled in app settings without configuring a provider.
Related errors
- provider_quota_exceeded
- model_currently_not_support
- provider_not_initialize
- NotLoggedIn
- completion_request_error
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/216d5fbe401f2e9a.
Report an issue: GitHub.