Error copying application #6945

Closed
opened 2026-02-21 18:18:04 -05:00 by yindo · 3 comments
Owner

Originally created by @onenov on GitHub (Nov 25, 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.12.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In the studio's application, click the Copy button to report an error (500 Internal Server Error)

✔️ Expected Behavior

No response

Actual Behavior

Request URL: /console/api/apps/-/copy
Request method: POST
Status Code: 500 Internal Server Error
Originally created by @onenov on GitHub (Nov 25, 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.12.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce In the studio's application, click the Copy button to report an error (500 Internal Server Error) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior ``` Request URL: /console/api/apps/-/copy Request method: POST Status Code: 500 Internal Server Error ```
yindo added the 🐞 bug label 2026-02-21 18:18:04 -05:00
yindo closed this issue 2026-02-21 18:18:04 -05:00
Author
Owner

@onenov commented on GitHub (Nov 25, 2024):

Docker-API-Log

2024-11-26 04:35:19.071 ERROR [Dummy-43] [app.py:838] - Exception on /console/api/apps/9ceea870-c3a6-4ba9-8991-5e4e7b02f66f/copy [POST]
Traceback (most recent call last):
File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/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 "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper
resp = resource(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
resp = meth(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 142, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/libs/login.py", line 92, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/wraps.py", line 26, in decorated
return view(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/app/wraps.py", line 49, in decorated_view
return view_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 696, in wrapper
resp = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/app/api/controllers/console/app/app.py", line 193, in post
stmt = select(App).where(App.id == result.app.id)
^^^^^^^^^^
File "/app/api/.venv/lib/python3.12/site-packages/pydantic/main.py", line 856, in __getattr__
raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'Import' object has no attribute 'app'
@onenov commented on GitHub (Nov 25, 2024): ### Docker-API-Log ``` 2024-11-26 04:35:19.071 ERROR [Dummy-43] [app.py:838] - Exception on /console/api/apps/9ceea870-c3a6-4ba9-8991-5e4e7b02f66f/copy [POST] Traceback (most recent call last): File "/app/api/.venv/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/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 "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 489, in wrapper resp = resource(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask/views.py", line 110, in view return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 604, in dispatch_request resp = meth(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 142, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/libs/login.py", line 92, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/wraps.py", line 26, in decorated return view(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/app/wraps.py", line 49, in decorated_view return view_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/flask_restful/__init__.py", line 696, in wrapper resp = f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/app/api/controllers/console/app/app.py", line 193, in post stmt = select(App).where(App.id == result.app.id) ^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/pydantic/main.py", line 856, in __getattr__ raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}') AttributeError: 'Import' object has no attribute 'app' ```
Author
Owner

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

The error you're encountering is due to an AttributeError in the app.py file, specifically when trying to access the app attribute on an Import object. The traceback indicates that the Import object does not have an app attribute, which is causing the 500 Internal Server Error.

The Import object is a Pydantic BaseModel used to represent the status and details of an import operation. It includes fields like id, status, app_id, current_dsl_version, imported_dsl_version, and error, but not app [1].

To resolve this issue, you should check the logic in the post method of the AppCopyApi class in app.py to ensure that you are accessing the correct attributes of the Import object. You might need to use app_id instead of app to retrieve the application details. Adjusting the code to correctly handle the Import object should help prevent this error.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 25, 2024): <!-- Answer --> The error you're encountering is due to an `AttributeError` in the `app.py` file, specifically when trying to access the `app` attribute on an `Import` object. The traceback indicates that the `Import` object does not have an `app` attribute, which is causing the 500 Internal Server Error. The `Import` object is a Pydantic `BaseModel` used to represent the status and details of an import operation. It includes fields like `id`, `status`, `app_id`, `current_dsl_version`, `imported_dsl_version`, and `error`, but not `app` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/services/app_dsl_service.py)</sup>. To resolve this issue, you should check the logic in the `post` method of the `AppCopyApi` class in `app.py` to ensure that you are accessing the correct attributes of the `Import` object. You might need to use `app_id` instead of `app` to retrieve the application details. Adjusting the code to correctly handle the `Import` object should help prevent this error. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

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

This has been fixed in #11091

@crazywoola commented on GitHub (Nov 25, 2024): This has been fixed in #11091
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6945