ghostfolio icon indicating copy to clipboard operation
ghostfolio copied to clipboard

[BUG] Unable to add new activities on most assets (500 Internal Server Error) and 404 on logos

Open msbt opened this issue 7 months ago • 7 comments

Bug Description

For a few weeks now I'm unable to add/clone activities to my portfolio. It always says "Oops! Something went wrong. Please try again later."

Browser console shows this:

ERROR 
Object { headers: {…}, status: 500, statusText: "Internal Server Error", url: "http://localhost:3333/api/v1/order", ok: false, type: undefined, name: "HttpErrorResponse", message: "Http failure response for http://localhost:3333/api/v1/order: 500 Internal Server Error", error: {…} }
​error: Object { statusCode: 500, message: "Internal server error" }
​​message: "Internal server error"
​​statusCode: 500
​​<prototype>: Object { … }
​headers: Object { headers: undefined, normalizedNames: Map(0), lazyInit: lazyInit(), … }
​​headers: undefined
​​lazyInit: function lazyInit()
​​lazyUpdate: null
​​normalizedNames: Map(0)
​​<prototype>: Object { … }
​message: "Http failure response for http://localhost:3333/api/v1/order: 500 Internal Server Error"
​name: "HttpErrorResponse"
​ok: false
​status: 500
​statusText: "Internal Server Error"
​type: undefined
​url: "http://localhost:3333/api/v1/order"
​<prototype>: Object { … }
main.eea76ee8199852d2.js:3:114301

It's very odd, since a few assets work and most of them don't. The few that do still show a logo/icon in the portfolio overfiew, the ones that don't show a 404 while trying to load it (see screenshot below)

To Reproduce

  1. Go to activities
  2. Manually add isin or clone existing asset
  3. Get error message

Expected Behavior

Successfully add new activities

Screenshots

Image

Logs

Not sure which logs to attach, please advise

Environment

  • Ghostfolio Version 2.164.0
  • Self-hosted local docker instance
  • Experimental Features: disabled
  • Browser: Firefox 137
  • OS: Ubuntu 24

Additional Context

Last activitiy I was able to add was a bit over a month ago, but I usually only do it once a month, so hard to pinpoint when it actually happened.

msbt avatar May 29 '25 06:05 msbt

Thanks for your bug report. Could you please attach the server log of the Internal Server Error?

dtslvr avatar May 29 '25 06:05 dtslvr

Thanks for the quick respone: When trying to duplicate, this is what shows up (I tried to use the watch feature and removed the items again after the 500 errors started to appear):

gf-postgres-build  | 2025-05-29 06:47:37.963 UTC [68] ERROR:  duplicate key value violates unique constraint "SymbolProfile_dataSource_symbol_key"
gf-postgres-build  | 2025-05-29 06:47:37.963 UTC [68] DETAIL:  Key ("dataSource", symbol)=(YAHOO, VWRD.L) already exists.
gf-postgres-build  | 2025-05-29 06:47:37.963 UTC [68] STATEMENT:  INSERT INTO "public"."SymbolProfile" ("createdAt","currency","dataSource","holdings","id","isActive","updatedAt","symbol") VALUES ($1,$2,CAST($3::text AS "public"."DataSource"),$4,$5,$6,$7,$8) RETURNING "public"."SymbolProfile"."id"
ghostfolio         | [Nest] 161  - 05/29/2025, 6:47:37 AM   ERROR [ExceptionsHandler] PrismaClientKnownRequestError: 
ghostfolio         | Invalid `prisma.order.create()` invocation:
ghostfolio         | 
ghostfolio         | 
ghostfolio         | Unique constraint failed on the fields: (`dataSource`,`symbol`)
ghostfolio         |     at Zn.handleRequestError (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:7459)
ghostfolio         |     at Zn.handleAndLogRequestError (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:6784)
ghostfolio         |     at Zn.request (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:6491)
ghostfolio         |     at async l (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:130:9778)
ghostfolio         |     at async OrderService.createOrder (/ghostfolio/apps/api/main.js:1:42984)
ghostfolio         |     at async OrderController.createOrder (/ghostfolio/apps/api/main.js:1:552405) {
ghostfolio         |   code: 'P2002',
ghostfolio         |   meta: {
ghostfolio         |     modelName: 'Order',
ghostfolio         |     target: [
ghostfolio         |       'dataSource',
ghostfolio         |       'symbol'
ghostfolio         |     ]
ghostfolio         |   },
ghostfolio         |   clientVersion: '6.8.2'
ghostfolio         | }

In the general startup it shows this a few times: gf-postgres-build | 2025-05-29 06:27:28.037 UTC [84] WARNING: database "ghostfolio-db" has no actual collation version, but a version was recorded

and for every currency it shows this ERROR [ExchangeRateDataService] No exchange rate has been found for USDEUR at 2025-05-25 for every day from 2021 until today - probably not an issue, but a bit spammy ;)

msbt avatar May 29 '25 06:05 msbt

It seems that my issue is similar this one https://github.com/ghostfolio/ghostfolio/issues/4421 only for a different reasons, I can't check asset details either, logs say this:

ghostfolio         | [Nest] 161  - 05/31/2025, 8:56:07 PM   ERROR [ExceptionsHandler] TypeError: Cannot read properties of undefined (reading 'currency')
ghostfolio         |     at PortfolioService.getHolding (/ghostfolio/apps/api/main.js:1:674790)
ghostfolio         |     at async PortfolioController.getHolding (/ghostfolio/apps/api/main.js:1:651750)

and this when I try to add a new entry:

ghostfolio         | [Nest] 161  - 05/31/2025, 8:57:43 PM     LOG [DataGatheringProcessor (GATHER_ASSET_PROFILE)] Asset profile data gathering has been started for CSNDX.SW (YAHOO)
gf-postgres-build  | 2025-05-31 20:57:43.485 UTC [55] ERROR:  duplicate key value violates unique constraint "SymbolProfile_dataSource_symbol_key"
gf-postgres-build  | 2025-05-31 20:57:43.485 UTC [55] DETAIL:  Key ("dataSource", symbol)=(YAHOO, CSNDX.SW) already exists.
gf-postgres-build  | 2025-05-31 20:57:43.485 UTC [55] STATEMENT:  INSERT INTO "public"."SymbolProfile" ("createdAt","currency","dataSource","holdings","id","isActive","updatedAt","symbol") VALUES ($1,$2,CAST($3::text AS "public"."DataSource"),$4,$5,$6,$7,$8) RETURNING "public"."SymbolProfile"."id"
ghostfolio         | [Nest] 161  - 05/31/2025, 8:57:43 PM   ERROR [ExceptionsHandler] PrismaClientKnownRequestError: 
ghostfolio         | Invalid `prisma.order.create()` invocation:
ghostfolio         | 
ghostfolio         | 
ghostfolio         | Unique constraint failed on the fields: (`dataSource`,`symbol`)
ghostfolio         |     at Zn.handleRequestError (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:7459)
ghostfolio         |     at Zn.handleAndLogRequestError (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:6784)
ghostfolio         |     at Zn.request (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:6491)
ghostfolio         |     at async l (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:130:9778)
ghostfolio         |     at async OrderService.createOrder (/ghostfolio/apps/api/main.js:1:518667)
ghostfolio         |     at async OrderController.createOrder (/ghostfolio/apps/api/main.js:1:502663) {
ghostfolio         |   code: 'P2002',
ghostfolio         |   meta: {
ghostfolio         |     modelName: 'Order',
ghostfolio         |     target: [
ghostfolio         |       'dataSource',
ghostfolio         |       'symbol'
ghostfolio         |     ]
ghostfolio         |   },
ghostfolio         |   clientVersion: '6.8.2'
ghostfolio         | }

msbt avatar Jun 01 '25 09:06 msbt

@msbt I tried to replicate this bug but was unsuccessful. Please try updating Ghostfolio to the latest version.

AnantaPodder avatar Jul 02 '25 04:07 AnantaPodder

@AnantaPodder I'm always using the latest version. What would be the proper way to recover from this? Export all activities and start fresh?

msbt avatar Jul 02 '25 16:07 msbt

Updated to v2.198.0 today and run into to same error:

[Nest] 7  - 09/12/2025, 7:06:04 PM   ERROR [ExceptionsHandler] PrismaClientKnownRequestError: 
Invalid `prisma.order.create()` invocation:
Unique constraint failed on the fields: (`dataSource`,`symbol`)
    at ei.handleRequestError (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:7283)
    at ei.handleAndLogRequestError (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:6608)
    at ei.request (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:121:6315)
    at async a (/ghostfolio/apps/api/node_modules/@prisma/client/runtime/library.js:130:9551)
    at async OrderService.createOrder (/ghostfolio/apps/api/main.js:1:540324)
    at async OrderController.createOrder (/ghostfolio/apps/api/main.js:1:523798) {
  code: 'P2002',

{
    modelName: 'Order',
    target: [
      'dataSource',
      'symbol'
    ]
  },
  clientVersion: '6.15.0'
}

I have tried to add an activity through the ui and by importing a .json file, with the same error message.

This error occurs for all securities where the logo can not be retrieved, but rather the request for the logo is returning a 404 at api/v1/logo/YAHOO/{SYMBOL}.

Loigzorn avatar Sep 12 '25 19:09 Loigzorn

I'm running into this error while trying to import my existing portfolio into ghostfolio for the first time setup.

joshkay avatar Oct 23 '25 16:10 joshkay