{"record":{"id":"35f7fe44acf04f6e","repo":"langgenius/dify","slug":"internal-server-error-35f7fe","errorCode":null,"errorMessage":"Internal Server Error","messagePattern":"Internal Server Error","errorType":"http","errorClass":"InternalServerError","httpStatus":500,"severity":"critical","filePath":"api/controllers/console/explore/message.py","lineNumber":196,"sourceCode":"            # response-contract:ignore compact_generate_response\n            return helper.compact_generate_response(response)\n        except MessageNotExistsError:\n            raise NotFound(\"Message Not Exists.\")\n        except MoreLikeThisDisabledError:\n            raise AppMoreLikeThisDisabledError()\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:\n            logger.exception(\"internal server error.\")\n            raise InternalServerError()\n\n\n@console_ns.route(\n    \"/installed-apps/<uuid:installed_app_id>/messages/<uuid:message_id>/suggested-questions\",\n    endpoint=\"installed_app_suggested_question\",\n)\nclass MessageSuggestedQuestionApi(InstalledAppResource):\n    @console_ns.response(200, \"Success\", console_ns.models[SuggestedQuestionsResponse.__name__])\n    @with_current_user\n    def get(self, current_user: Account, installed_app: InstalledApp, message_id: UUID):\n        app_model = installed_app.app_with_session(session=db.session())\n        if app_model is None:\n            raise AppUnavailableError()\n        app_mode = AppMode.value_of(app_model.mode)\n        if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}:\n            raise NotChatAppError()\n\n        message_id_str = str(message_id)","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/explore/message.py#L178-L214","documentation":"HTTP 500 InternalServerError, raised by the catch-all 'except Exception' in the more-like-this handler after logging 'internal server error.'. Any unhandled exception from generate_more_like_this that is not one of the mapped service errors falls through to this.","triggerScenarios":"GET more-like-this triggers an unexpected server-side bug — unmodeled exception in AppGenerateService, a serialization error, DB session fault, or a provider error type not in the explicit except chain. The handler logs the traceback and returns 500.","commonSituations":"Bug in a downstream service; new error type added by a provider runtime that the controller does not yet translate; resource exhaustion (DB pool); corrupted app config that throws during generation.","solutions":["Check the server logs for the traceback logged by logger.exception('internal server error.') — the message identifies the real cause.","Retry idempotently once in case the cause was transient (e.g. DB connection).","If reproducible, file a bug with the request URL, app_id, and message_id; the controller should be extended to translate the new error type.","As a temporary measure, switch the app to a different provider/model to bypass the failing path."],"exampleFix":"// before: no error handling around more-like-this\nconst r = await get(moreLikeThisUrl(id, mid));\n\n// after: surface 500 distinctly and retry once\ntry {\n  const r = await get(moreLikeThisUrl(id, mid));\n} catch (e) {\n  if (e.status === 500) {\n    await sleep(500);\n    const r = await get(moreLikeThisUrl(id, mid)); // one retry\n  } else throw e;\n}","handlingStrategy":"try-catch","validationCode":"// No client validation can prevent a true 500; preflight only avoids the mapped 4xx cases\nif (!appAvailable(app) || !isCompletionApp(app)) return; // avoids 745/752, not 759","typeGuard":null,"tryCatchPattern":"try {\n  return await get(moreLikeThisUrl(id, mid));\n} catch (e) {\n  if (e.status === 500) {\n    await sleep(500);\n    return await get(moreLikeThisUrl(id, mid)); // single idempotent retry\n  }\n  throw e;\n}","preventionTips":["Inspect server logs for the traceback from logger.exception('internal server error.').","Retry once for transient causes (DB pool, brief outage).","File a bug with app_id and message_id; extend the controller's except chain to translate the new error.","Switch provider/model as a workaround while the root cause is fixed."],"tags":["rest-api","explore","internal-server-error","unhandled","more-like-this","dify"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}