langgenius/dify · error · InternalServerError

The server encountered an internal error and was unable to c

Error message

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

What it means

Generic HTTP 500 InternalServerError emitted by the catch-all 'except Exception' branch of AdvancedChatDraftWorkflowRunApi.post (POST /apps/{app_id}/advanced-chat/workflows/draft/run). It fires for any failure raised by AppGenerateService.generate that is NOT ConversationNotExistsError, ConversationCompletedError, InvokeRateLimitError, or a bare ValueError. The real cause is logged via logger.exception('internal server error.') server-side, so the message text is intentionally uninformative.

Source

Thrown at api/controllers/console/app/workflow.py:735

                app_model=app_model,
                user=current_user,
                args=args,
                invoke_from=InvokeFrom.DEBUGGER,
                streaming=True,
            )

            return helper.compact_generate_response(response)
        except services.errors.conversation.ConversationNotExistsError:
            raise NotFound("Conversation Not Exists.")
        except services.errors.conversation.ConversationCompletedError:
            raise ConversationCompletedError()
        except InvokeRateLimitError as ex:
            raise InvokeRateLimitHttpError(ex.description)
        except ValueError as e:
            raise e
        except Exception:
            logger.exception("internal server error.")
            raise InternalServerError()


@console_ns.route("/apps/<uuid:app_id>/advanced-chat/workflows/draft/iteration/nodes/<string:node_id>/run")
class AdvancedChatDraftRunIterationNodeApi(Resource):
    @console_ns.doc("run_advanced_chat_draft_iteration_node")
    @console_ns.doc(description="Run draft workflow iteration node for advanced chat")
    @console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
    @console_ns.expect(console_ns.models[IterationNodeRunPayload.__name__])
    @console_ns.response(
        200,
        "Iteration node run started successfully",
        console_ns.models[GeneratedAppResponse.__name__],
    )
    @console_ns.response(403, "Permission denied")
    @console_ns.response(404, "Node not found")
    @setup_required
    @login_required
    @account_initialization_required

View on GitHub (pinned to ef8544b173)

Solutions

  1. Read the server stack trace logged at 'internal server error.' to find the originating exception class and message.
  2. Reproduce with the same payload and check connectivity to the model provider and the app DB.
  3. If the cause is a provider/plugin error, fix the node config or credentials, then re-run.
  4. If the cause is a code defect, file an issue with the full stack trace and the workflow JSON.
Defensive patterns

Strategy: try-catch

Try / catch

// Treat any non-named 5xx as opaque; collect a server-side correlation id and surface a generic retry.
try {
  return await advancedChatDraftRun(appId, body);
} catch (e) {
  if (e?.status >= 500) {
    reportToUser('Workflow run failed on the server. See server logs.');
    maybeRetryOnce();
  }
  throw e;
}

Prevention

When it happens

Trigger: Any unanticipated exception during advanced-chat draft generation: model provider outage, broken node configuration, serialization error, DB connectivity drop, plugin invocation failure, or a bug in a custom node — anything not matching the named except clauses.

Common situations: Upstream LLM provider returns an unexpected status, a workflow references a deleted model/provider, celery/queue backend is unreachable, or a code defect in core/task_runner surfaces only at runtime.

Related errors


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