{"record":{"id":"ccdb24af4a6a697b","repo":"langgenius/dify","slug":"internal-server-error-ccdb24","errorCode":null,"errorMessage":"Internal Server Error","messagePattern":"Internal Server Error","errorType":"http","errorClass":"InternalServerError","httpStatus":500,"severity":"critical","filePath":"api/controllers/console/explore/audio.py","lineNumber":94,"sourceCode":"        except UnsupportedAudioTypeServiceError:\n            raise UnsupportedAudioTypeError()\n        except ProviderNotSupportSpeechToTextServiceError:\n            raise ProviderNotSupportSpeechToTextError()\n        except SpeechToTextDisabledServiceError:\n            raise SpeechToTextDisabledError()\n        except ProviderTokenNotInitError as ex:\n            raise ProviderNotInitializeError(ex.description)\n        except QuotaExceededError:\n            raise ProviderQuotaExceededError()\n        except ModelCurrentlyNotSupportError:\n            raise ProviderModelCurrentlyNotSupportError()\n        except InvokeError as e:\n            raise CompletionRequestError(e.description)\n        except ValueError as e:\n            raise e\n        except Exception as e:\n            logger.exception(\"internal server error.\")\n            raise InternalServerError()\n\n\n@console_ns.route(\n    \"/installed-apps/<uuid:installed_app_id>/text-to-audio\",\n    endpoint=\"installed_app_text\",\n)\nclass ChatTextApi(InstalledAppResource):\n    @console_ns.expect(console_ns.models[TextToAudioPayload.__name__])\n    @console_ns.response(200, \"Success\", console_ns.models[AudioBinaryResponse.__name__])\n    @model_validate(TextToAudioPayload)\n    def post(self, req_data: TextToAudioPayload, installed_app: InstalledApp):\n        app_model = installed_app.app_with_session(session=db.session())\n        if app_model is None:\n            raise AppUnavailableError()\n        try:\n            message_id = req_data.message_id\n            text = req_data.text\n            voice = req_data.voice","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/explore/audio.py#L76-L112","documentation":"HTTP 500 InternalServerError (werkzeug.exceptions.InternalServerError), the catch-all at the bottom of the STT endpoint's try/except. Any exception not matched by the specific service-error handlers (and not a ValueError) is logged via logger.exception('internal server error.') and converted to a 500. This is intentionally generic: it masks unexpected faults from the client while preserving a full stack trace server-side.","triggerScenarios":"POST /console/explore/installed-apps/{id}/audio-to-text that fails for a reason outside the enumerated service errors: an unanticipated TypeError/KeyError in AudioService, a database session error, a serialization bug, an unhandled model runtime exception type, or an infrastructure fault.","commonSituations":"Bug in a new code path not yet mapped to a service error; DB connection dropped mid-request; partial deploy where a module attribute is missing; an upstream library bumped and raised a new exception type the handler does not catch.","solutions":["Read the server log for the logger.exception trace at this line — it is the authoritative source of the real cause.","Reproduce with the same payload and fix the underlying fault, then add a specific service-error mapping if it is a recurring class of failure.","If transient (DB/network), retry the request once.","Do not expose this to end users; surface a friendly message in the client and report the incident with the log trace."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await postAudio(file) }\ncatch (e) {\n  if (e.status === 500) { reportIncident(e.request_id); showFriendlyError() }\n  else throw e\n}","preventionTips":["Always correlate client errors to a server-side request id and ship the logger.exception trace to ops.","Add integration tests for new AudioService paths so unexpected exceptions get specific handlers.","Alert on any 500 spike from this endpoint; it indicates an unhandled fault."],"tags":["audio","stt","catch-all","http-500","logging"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}