Cloud't create a workflow #6521

Closed
opened 2026-02-21 18:16:07 -05:00 by yindo · 4 comments
Owner

Originally created by @elrondwong on GitHub (Nov 4, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.10.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

run server

flask run --host 0.0.0.0 --port=5001 --debug
celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace
npm run  start

create a workflow from blank

image image

flash console log

2024-11-04 06:23:05,059.059 INFO [Thread-156 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/draft HTTP/1.1" 400 -
2024-11-04 06:23:05,084.084 INFO [Thread-157 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/default-workflow-block-configs HTTP/1.1" 200 -
2024-11-04 06:23:05,665.665 INFO [Thread-158 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/workspaces/current/tools/builtin HTTP/1.1" 200 -
2024-11-04 06:23:05,682.682 INFO [Thread-159 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/workspaces/current/tools/api HTTP/1.1" 200 -
2024-11-04 06:23:05,703.703 INFO [Thread-160 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/workspaces/current/tools/workflow HTTP/1.1" 200 -
2024-11-04 06:23:05,739.739 ERROR [Thread-161 (process_request_thread)] [app.py:838] - Exception on /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/draft [POST]
Traceback (most recent call last):
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.NotNullViolation: null value in column "updated_at" of relation "workflows" violates not-null constraint
DETAIL:  Failing row contains (66a9c6f1-3c2e-4dfb-895d-e54859466a0c, 79577fe2-8492-4e88-a2ac-8785da7c656b, 6c488bac-4d24-47a3-9d37-6b63c936c4d7, workflow, draft, {"nodes": [{"id": "1730701384957", "type": "custom", "data": {"t..., {"retriever_resource": {"enabled": true}, "file_upload": {}, "te..., 9188cc89-59c7-41e5-bc50-7ee8517e1677, 2024-11-04 06:23:06, null, null, {}, {}).


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
    resp = resource(*args, **kwargs)
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)  # type: ignore[no-any-return]
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/wraps.py", line 142, in decorated
    return view(*args, **kwargs)
  File "/Users/wanggangfeng/work/ai/dify/api/libs/login.py", line 92, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
  File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/wraps.py", line 26, in decorated
    return view(*args, **kwargs)
  File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/app/wraps.py", line 49, in decorated_view
    return view_func(*args, **kwargs)
  File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/app/workflow.py", line 110, in post
    workflow = workflow_service.sync_draft_workflow(
  File "/Users/wanggangfeng/work/ai/dify/api/services/workflow_service.py", line 123, in sync_draft_workflow
    db.session.commit()
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/scoping.py", line 597, in commit
    return self._proxied.commit()
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2028, in commit
    trans.commit(_to_root=True)
  File "<string>", line 2, in commit
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1313, in commit
    self._prepare_impl()
  File "<string>", line 2, in _prepare_impl
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1288, in _prepare_impl
    self.session.flush()
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4352, in flush
    self._flush(objects)
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4487, in _flush
    with util.safe_reraise():
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4448, in _flush
    flush_context.execute()
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute
    rec.execute(self)
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute
    util.preloaded.orm_persistence.save_obj(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj
    _emit_insert_statements(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 1233, in _emit_insert_statements
    result = connection.execute(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute
    return meth(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement
    ret = self._execute_context(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
    return self._exec_single_context(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
    self._handle_dbapi_exception(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
    self.dialect.do_execute(
  File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "updated_at" of relation "workflows" violates not-null constraint
DETAIL:  Failing row contains (66a9c6f1-3c2e-4dfb-895d-e54859466a0c, 79577fe2-8492-4e88-a2ac-8785da7c656b, 6c488bac-4d24-47a3-9d37-6b63c936c4d7, workflow, draft, {"nodes": [{"id": "1730701384957", "type": "custom", "data": {"t..., {"retriever_resource": {"enabled": true}, "file_upload": {}, "te..., 9188cc89-59c7-41e5-bc50-7ee8517e1677, 2024-11-04 06:23:06, null, null, {}, {}).

[SQL: INSERT INTO workflows (tenant_id, app_id, type, version, graph, features, created_by, updated_by, updated_at, environment_variables, conversation_variables) VALUES (%(tenant_id)s::UUID, %(app_id)s::UUID, %(type)s, %(version)s, %(graph)s, %(features)s, %(created_by)s::UUID, %(updated_by)s::UUID, %(updated_at)s, %(environment_variables)s, %(conversation_variables)s) RETURNING workflows.id, workflows.created_at]
[parameters: {'tenant_id': '79577fe2-8492-4e88-a2ac-8785da7c656b', 'app_id': '6c488bac-4d24-47a3-9d37-6b63c936c4d7', 'type': 'workflow', 'version': 'draft', 'graph': '{"nodes": [{"id": "1730701384957", "type": "custom", "data": {"type": "start", "title": "Start", "desc": "", "variables": []}, "position": {"x": 80, "y": 282}, "targetPosition": "left", "sourcePosition": "right"}], "edges": []}', 'features': '{"retriever_resource": {"enabled": true}, "file_upload": {}, "text_to_speech": {"enabled": false, "voice": "", "language": ""}, "sensitive_word_avoidance": {"enabled": false}}', 'created_by': '9188cc89-59c7-41e5-bc50-7ee8517e1677', 'updated_by': None, 'updated_at': None, 'environment_variables': '{}', 'conversation_variables': '{}'}]
(Background on this error at: https://sqlalche.me/e/20/gkpj)
2024-11-04 06:23:05,744.744 INFO [Thread-161 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "POST /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/draft HTTP/1.1" 500 -

✔️ Expected Behavior

Create workflow from blank successfully

Actual Behavior

UI hangging
api logging erros

Originally created by @elrondwong on GitHub (Nov 4, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.10.2 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce # run server ```bash flask run --host 0.0.0.0 --port=5001 --debug celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace npm run start ``` # create a workflow from blank <img width="1610" alt="image" src="https://github.com/user-attachments/assets/e9b77b0f-9e39-4193-a870-16473cf19510"> <img width="1665" alt="image" src="https://github.com/user-attachments/assets/3f615945-4444-48d2-85cf-2b09c7f7b815"> # flash console log ```log 2024-11-04 06:23:05,059.059 INFO [Thread-156 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/draft HTTP/1.1" 400 - 2024-11-04 06:23:05,084.084 INFO [Thread-157 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/default-workflow-block-configs HTTP/1.1" 200 - 2024-11-04 06:23:05,665.665 INFO [Thread-158 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/workspaces/current/tools/builtin HTTP/1.1" 200 - 2024-11-04 06:23:05,682.682 INFO [Thread-159 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/workspaces/current/tools/api HTTP/1.1" 200 - 2024-11-04 06:23:05,703.703 INFO [Thread-160 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "GET /console/api/workspaces/current/tools/workflow HTTP/1.1" 200 - 2024-11-04 06:23:05,739.739 ERROR [Thread-161 (process_request_thread)] [app.py:838] - Exception on /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/draft [POST] Traceback (most recent call last): File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) psycopg2.errors.NotNullViolation: null value in column "updated_at" of relation "workflows" violates not-null constraint DETAIL: Failing row contains (66a9c6f1-3c2e-4dfb-895d-e54859466a0c, 79577fe2-8492-4e88-a2ac-8785da7c656b, 6c488bac-4d24-47a3-9d37-6b63c936c4d7, workflow, draft, {"nodes": [{"id": "1730701384957", "type": "custom", "data": {"t..., {"retriever_resource": {"enabled": true}, "file_upload": {}, "te..., 9188cc89-59c7-41e5-bc50-7ee8517e1677, 2024-11-04 06:23:06, null, null, {}, {}). The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request rv = self.dispatch_request() File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return] File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/wraps.py", line 142, in decorated return view(*args, **kwargs) File "/Users/wanggangfeng/work/ai/dify/api/libs/login.py", line 92, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/wraps.py", line 26, in decorated return view(*args, **kwargs) File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/app/wraps.py", line 49, in decorated_view return view_func(*args, **kwargs) File "/Users/wanggangfeng/work/ai/dify/api/controllers/console/app/workflow.py", line 110, in post workflow = workflow_service.sync_draft_workflow( File "/Users/wanggangfeng/work/ai/dify/api/services/workflow_service.py", line 123, in sync_draft_workflow db.session.commit() File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/scoping.py", line 597, in commit return self._proxied.commit() File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2028, in commit trans.commit(_to_root=True) File "<string>", line 2, in commit File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1313, in commit self._prepare_impl() File "<string>", line 2, in _prepare_impl File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go ret_value = fn(self, *arg, **kw) File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1288, in _prepare_impl self.session.flush() File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4352, in flush self._flush(objects) File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4487, in _flush with util.safe_reraise(): File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__ raise exc_value.with_traceback(exc_tb) File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 4448, in _flush flush_context.execute() File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 466, in execute rec.execute(self) File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/unitofwork.py", line 642, in execute util.preloaded.orm_persistence.save_obj( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 93, in save_obj _emit_insert_statements( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/orm/persistence.py", line 1233, in _emit_insert_statements result = connection.execute( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1418, in execute return meth( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection return connection._execute_clauseelement( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement ret = self._execute_context( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context return self._exec_single_context( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context self._handle_dbapi_exception( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2355, in _handle_dbapi_exception raise sqlalchemy_exception.with_traceback(exc_info[2]) from e File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context self.dialect.do_execute( File "/Users/wanggangfeng/work/ai/dify/api/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 941, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) null value in column "updated_at" of relation "workflows" violates not-null constraint DETAIL: Failing row contains (66a9c6f1-3c2e-4dfb-895d-e54859466a0c, 79577fe2-8492-4e88-a2ac-8785da7c656b, 6c488bac-4d24-47a3-9d37-6b63c936c4d7, workflow, draft, {"nodes": [{"id": "1730701384957", "type": "custom", "data": {"t..., {"retriever_resource": {"enabled": true}, "file_upload": {}, "te..., 9188cc89-59c7-41e5-bc50-7ee8517e1677, 2024-11-04 06:23:06, null, null, {}, {}). [SQL: INSERT INTO workflows (tenant_id, app_id, type, version, graph, features, created_by, updated_by, updated_at, environment_variables, conversation_variables) VALUES (%(tenant_id)s::UUID, %(app_id)s::UUID, %(type)s, %(version)s, %(graph)s, %(features)s, %(created_by)s::UUID, %(updated_by)s::UUID, %(updated_at)s, %(environment_variables)s, %(conversation_variables)s) RETURNING workflows.id, workflows.created_at] [parameters: {'tenant_id': '79577fe2-8492-4e88-a2ac-8785da7c656b', 'app_id': '6c488bac-4d24-47a3-9d37-6b63c936c4d7', 'type': 'workflow', 'version': 'draft', 'graph': '{"nodes": [{"id": "1730701384957", "type": "custom", "data": {"type": "start", "title": "Start", "desc": "", "variables": []}, "position": {"x": 80, "y": 282}, "targetPosition": "left", "sourcePosition": "right"}], "edges": []}', 'features': '{"retriever_resource": {"enabled": true}, "file_upload": {}, "text_to_speech": {"enabled": false, "voice": "", "language": ""}, "sensitive_word_avoidance": {"enabled": false}}', 'created_by': '9188cc89-59c7-41e5-bc50-7ee8517e1677', 'updated_by': None, 'updated_at': None, 'environment_variables': '{}', 'conversation_variables': '{}'}] (Background on this error at: https://sqlalche.me/e/20/gkpj) 2024-11-04 06:23:05,744.744 INFO [Thread-161 (process_request_thread)] [_internal.py:97] - 127.0.0.1 - - [04/Nov/2024 06:23:05] "POST /console/api/apps/6c488bac-4d24-47a3-9d37-6b63c936c4d7/workflows/draft HTTP/1.1" 500 - ``` ### ✔️ Expected Behavior Create workflow from blank successfully ### ❌ Actual Behavior UI hangging api logging erros
yindo added the 🐞 bug🌊 feat:workflow labels 2026-02-21 18:16:07 -05:00
yindo closed this issue 2026-02-21 18:16:07 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 4, 2024):

Hello, @elrondwong! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're facing.

The error you're encountering, "null value in column 'updated_at' of relation 'workflows' violates not-null constraint," is due to the updated_at field not being set when creating a new workflow. This field is expected to have a value, and the application logic should ensure it is set.

To resolve this issue, ensure that the updated_at field is assigned a value when creating or updating a workflow. In the Dify application, this is typically done by setting the updated_at field to the current UTC time using datetime.now(timezone.utc).replace(tzinfo=None) in the sync_draft_workflow method [1][2].

Check your application code to ensure that this logic is correctly implemented and that the updated_at field is being set appropriately during the workflow creation process.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 4, 2024): <!-- Greeting --> Hello, @elrondwong! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're facing. <!-- Answer --> The error you're encountering, "null value in column 'updated_at' of relation 'workflows' violates not-null constraint," is due to the `updated_at` field not being set when creating a new workflow. This field is expected to have a value, and the application logic should ensure it is set. To resolve this issue, ensure that the `updated_at` field is assigned a value when creating or updating a workflow. In the Dify application, this is typically done by setting the `updated_at` field to the current UTC time using `datetime.now(timezone.utc).replace(tzinfo=None)` in the `sync_draft_workflow` method <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/controllers/console/app/workflow.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/services/workflow_service.py)</sup>. Check your application code to ensure that this logic is correctly implemented and that the `updated_at` field is being set appropriately during the workflow creation process. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Nov 4, 2024):

Please run the migration before run those commands.

@crazywoola commented on GitHub (Nov 4, 2024): Please run the migration before run those commands.
Author
Owner

@elrondwong commented on GitHub (Nov 4, 2024):

how to migration, first run

@elrondwong commented on GitHub (Nov 4, 2024): how to migration, first run
Author
Owner

@elrondwong commented on GitHub (Nov 4, 2024):

https://github.com/langgenius/dify/blob/main/api/README.md

@elrondwong commented on GitHub (Nov 4, 2024): https://github.com/langgenius/dify/blob/main/api/README.md
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6521