langgenius/dify · critical · InternalServerError
Internal Server Error
Error message
Internal Server Error
What it means
Returned (HTTP 500, generic) by POST .../draft/iteration/nodes/<node_id>/run when any exception other than ConversationNotExistsError, ConversationCompletedError, or ValueError escapes `PipelineGenerateService.generate_single_iteration`. The controller logs the traceback (`logging.exception`) and re-raises as werkzeug InternalServerError — the original cause is not surfaced to the client.
Source
Thrown at api/controllers/console/datasets/rag_pipeline/rag_pipeline_workflow.py:299
Run draft workflow iteration node
"""
args = req_data.model_dump(exclude_none=True)
try:
response = PipelineGenerateService.generate_single_iteration(
pipeline=pipeline, user=current_user, node_id=node_id, args=args, session=db.session(), 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 ValueError as e:
raise e
except Exception:
logging.exception("internal server error.")
raise InternalServerError()
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/loop/nodes/<string:node_id>/run")
class RagPipelineDraftRunLoopNodeApi(Resource):
@console_ns.expect(console_ns.models[NodeRunPayload.__name__])
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
@setup_required
@login_required
@account_initialization_required
@edit_permission_required
@rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_EDIT)
@with_current_user
@get_rag_pipeline
@model_validate(NodeRunPayload)
def post(self, req_data: NodeRunPayload, current_user: Account, pipeline: Pipeline, node_id: str):
"""
Run draft workflow loop node
"""View on GitHub (pinned to ef8544b173)
Solutions
- Inspect the Dify backend logs for the `internal server error.` traceback to find the root cause.
- Reproduce with the same node_id and inputs after addressing the logged exception.
- If the cause is a provider error, validate credentials and rate limits on the LLM model provider.
- File a bug with the traceback, node_id, and inputs (redacted) if no actionable cause appears.
Example fix
// not a client-side fix; server logs are required
// 1) grep backend logs: `logging.exception("internal server error.")`
// 2) read the traceback, fix the underlying node/service
// 3) retry the iteration run Defensive patterns
Strategy: try-catch
Validate before calling
// cannot fully prevent — server-side bug. Add precondition checks to reduce incidence:
if (!nodeId) throw new Error('nodeId required')
if (!pipelineId) throw new Error('pipelineId required')
// then call; if 500, surface the server-side traceback to ops Try / catch
try {
await post(`${base}/draft/iteration/nodes/${nodeId}/run`, payload)
} catch (e) {
if (e.status === 500) {
// surface 'internal error, please contact support'; do NOT blind-retry
// correlate with backend log line `internal server error.`
} else throw e
} Prevention
- Do not blind-retry 500 responses — investigate logs first.
- Capture node_id and inputs (redacted) for support tickets.
- Keep the Dify backend and node plugins on compatible versions.
- Validate provider credentials before driving iteration runs.
When it happens
Trigger: Database connectivity loss mid-run, serialization failures, unhandled KeyError in a node implementation, plugin/model-runtime crashes, infrastructure errors (redis, storage), or bugs in the iteration node's execution path.
Common situations: Misconfigured LLM provider credentials. Node plugin throws an unexpected exception. Transient infra outages. Schema drift between graph and node runtime.
Understand the failure class
- HTTP status errors: handling 4xx and 5xx responses — how to handle 4xx and 5xx responses properly.
Related errors
- Conversation Not Exists.
- conversation_completed
- expected dict for file, got {type(raw_value)}
- expected list for files, got {type(raw_value)}
- expected dict for files[0], got {type(raw_value)}
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/dfd4216116f9470e.
Report an issue: GitHub.