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 ProviderNotInitializeError, raised by the STT endpoint. The model layer raised ProviderTokenNotInitError, meaning the resolved model provider has no valid credentials configured. The controller passes the exception's description through verbatim. This is distinct from 681 (no model instance at all): here a provider/model was selected but its API key/token is missing or invalid.

Source

Thrown at api/controllers/console/explore/audio.py:83

                end_user=None,
            )

            return response
        except services.errors.app_model_config.AppModelConfigBrokenError:
            logger.exception("App model config broken.")
            raise AppUnavailableError()
        except NoAudioUploadedServiceError:
            raise NoAudioUploadedError()
        except AudioTooLargeServiceError as e:
            raise AudioTooLargeError(str(e))
        except UnsupportedAudioTypeServiceError:
            raise UnsupportedAudioTypeError()
        except ProviderNotSupportSpeechToTextServiceError:
            raise ProviderNotSupportSpeechToTextError()
        except SpeechToTextDisabledServiceError:
            raise SpeechToTextDisabledError()
        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 ValueError as e:
            raise e
        except Exception as e:
            logger.exception("internal server error.")
            raise InternalServerError()


@console_ns.route(
    "/installed-apps/<uuid:installed_app_id>/text-to-audio",
    endpoint="installed_app_text",
)
class ChatTextApi(InstalledAppResource):

View on GitHub (pinned to ef8544b173)

Solutions

  1. Go to Settings -> Model Provider, open the relevant provider, and add/refresh the API credentials.
  2. Use 'devkey' / your credential manager to supply the key rather than pasting it in chat.
  3. Validate the credential by running the provider's built-in check in the UI after saving.
  4. If self-hosted, confirm the secret is mounted into the container env the API process actually reads.
Defensive patterns

Strategy: try-catch

Try / catch

try { await postAudio(file) }
catch (e) { if (e.code === 400 && e.error_code === 'provider_not_initialize') promptAddCredentials() else throw e }

Prevention

When it happens

Trigger: POST /console/explore/installed-apps/{id}/audio-to-text where the tenant has a default speech2text model selected but the backing provider credentials were never entered, were cleared, or failed validation at invoke time.

Common situations: Admin selected a model from a provider but never pasted the API key; credentials were deleted; provider credentials revoked by the upstream vendor; environment-specific key not loaded in a self-hosted deploy.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/3fda42a3666a218b. Report an issue: GitHub.